From cdd2d583795449b415980f4e7b6d6348d156faa1 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sun, 14 Oct 2012 15:11:13 +0200 Subject: [PATCH] Add a test for using PropertyAnimation with QSlider... it just rocks! ;) --- animation.qml | 31 +++++++++++++++++++++++++++++++ main.cpp | 3 ++- 2 files changed, 33 insertions(+), 1 deletions(-) create mode 100644 animation.qml diff --git a/animation.qml b/animation.qml new file mode 100644 index 0000000..3d75237 --- /dev/null +++ b/animation.qml @@ -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 + } + } + } +} diff --git a/main.cpp b/main.cpp index a52f801..c3e8391 100644 --- 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(); -- 1.7.2.5