summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/animation/sequential/main.cpp
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-05-25 07:55:55 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-05-25 07:55:55 (GMT)
commitacc6122892a33b845da32b1d5b30dc6852c17e73 (patch)
tree978a84a77a6bccff08bace60d47a6b14cd9eefd2 /doc/src/snippets/animation/sequential/main.cpp
parent43eccd4e52402b9020a0cf26aa1486784f8abe0e (diff)
parent4147a2c788c39f09ef87181768a779cb701fd2bd (diff)
downloadQt-acc6122892a33b845da32b1d5b30dc6852c17e73.zip
Qt-acc6122892a33b845da32b1d5b30dc6852c17e73.tar.gz
Qt-acc6122892a33b845da32b1d5b30dc6852c17e73.tar.bz2
Merge branch 'master' into graphics-master
Diffstat (limited to 'doc/src/snippets/animation/sequential/main.cpp')
-rw-r--r--doc/src/snippets/animation/sequential/main.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/src/snippets/animation/sequential/main.cpp b/doc/src/snippets/animation/sequential/main.cpp
new file mode 100644
index 0000000..aff8f29
--- /dev/null
+++ b/doc/src/snippets/animation/sequential/main.cpp
@@ -0,0 +1,50 @@
+#include <QApplication>
+#include <QLabel>
+#include <QPropertyAnimation>
+#include <QSequentialAnimationGroup>
+#include "tracer.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QWidget window;
+ window.resize(720, 96);
+ window.show();
+
+ QLabel *label1 = new QLabel(&window);
+ label1->setPixmap(QPixmap(":/icons/left.png"));
+ label1->move(16, 16);
+ label1->show();
+
+ QLabel *label2 = new QLabel(&window);
+ label2->setPixmap(QPixmap(":/icons/right.png"));
+ label2->move(320, 16);
+ label2->show();
+
+ QPropertyAnimation *anim1 = new QPropertyAnimation(label1, "pos");
+ anim1->setDuration(2500);
+ anim1->setStartValue(QPoint(16, 16));
+ anim1->setEndValue(QPoint(320, 16));
+
+ QPropertyAnimation *anim2 = new QPropertyAnimation(label2, "pos");
+ anim2->setDuration(2500);
+ anim2->setStartValue(QPoint(320, 16));
+ anim2->setEndValue(QPoint(640, 16));
+
+ QSequentialAnimationGroup group;
+ group.addAnimation(anim1);
+ group.addAnimation(anim2);
+
+ Tracer tracer(&window);
+
+ QObject::connect(anim1, SIGNAL(valueChanged(QVariant)),
+ &tracer, SLOT(recordValue(QVariant)));
+ QObject::connect(anim2, SIGNAL(valueChanged(QVariant)),
+ &tracer, SLOT(recordValue(QVariant)));
+ QObject::connect(anim1, SIGNAL(finished()), &tracer, SLOT(checkValue()));
+ QObject::connect(anim2, SIGNAL(finished()), &tracer, SLOT(checkValue()));
+
+ group.start();
+ return app.exec();
+}