add history widget
[mdictionary] / src / mdictionary / qml / ProgressBar.qml
index 2e102c3..2a0de49 100644 (file)
@@ -10,7 +10,13 @@ Rectangle {
 
     function setMax(intiger) { maximum=intiger }
     function setMin(intiger) { minimum=intiger }
-    function setValue(intiger) { value= intiger }
+    function setValue(intiger) {
+        value= intiger;
+        if(intiger>-1){
+            highlight.anchors.leftMargin=0;
+            highlight.anchors.position=0;
+        }
+    }
     function setValue2(intiger) { value2= intiger }
 
     width: 250;
@@ -40,11 +46,11 @@ Rectangle {
             }
         }
 
-        Behavior on anchors.leftMargin {
+        Behavior on position {
             SequentialAnimation{
-                loops: Animation.Infinite
-                SmoothedAnimation { velocity: 450; to: progressBar.width - 96}
-                SmoothedAnimation { velocity: 450; to: 6 }
+                loops:  (value>-1)?0:Animation.Infinite
+                SmoothedAnimation { velocity:450 ; to: progressBar.width - 96}
+                SmoothedAnimation { velocity: 450 ; to: 6 }
             }
         }
 
@@ -68,6 +74,6 @@ Rectangle {
         anchors.verticalCenter: parent.verticalCenter
         color: "white"
         font.bold: true
-        text: (value>-1) ? (Math.floor((value - minimum) / (maximum - minimum) * 100) + '%') : ("???");
+        text: (value>-1) ? (Math.floor((value - minimum) / (maximum - minimum) * 100) + '%') : ("");
     }
 }