Add a test for using PropertyAnimation with QSlider... it just rocks! ;)
authorTobias Koenig <tobias.koenig@kdab.com>
Sun, 14 Oct 2012 13:11:13 +0000 (15:11 +0200)
committerTobias Koenig <tobias.koenig@kdab.com>
Sun, 14 Oct 2012 13:11:13 +0000 (15:11 +0200)
animation.qml [new file with mode: 0644]
main.cpp

diff --git a/animation.qml b/animation.qml
new file mode 100644 (file)
index 0000000..3d75237
--- /dev/null
@@ -0,0 +1,31 @@
+import QtQuick 1.0
+import QtGui 1.0
+
+Widget {
+  VBoxLayout {
+    PushButton {
+      id: button
+      text: anim.running ? qsTr("Stop animation") : qsTr("Start animation")
+      checkable: true
+    }
+
+    Slider {
+      id: slider
+
+      minimum: 0
+      maximum: 100
+      PropertyAnimation {
+        id: anim
+
+        running: button.checked
+        target: slider
+        property: "value"
+        from: 0
+        to: 100
+        duration: 3000
+        easing.type: Easing.InOutBounce
+        loops: Animation.Infinite
+      }
+    }
+  }
+}
index a52f801..c3e8391 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -12,7 +12,8 @@ int main(int argc, char **argv)
   timer.setInterval(1000);
   timer.start();
 
-  DeclarativeWidgetDocument document(QUrl("test.qml"));
+  //DeclarativeWidgetDocument document(QUrl("test.qml"));
+  DeclarativeWidgetDocument document(QUrl("animation.qml"));
   document.setContextProperty("_timer", &timer);
 
   QWidget *widget = document.create<QWidget>();