Qt 5.10 Book Examples
main.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // main.cpp
3 // ======================================================================
4 // This file is a part of the book
5 // "Qt 5.10 Professional programming with C++"
6 // http://qt-book.com
7 // ======================================================================
8 // Copyright (c) 2017 by Max Schlee
9 // ======================================================================
10 
11 #include <QtWidgets>
12 
13 // ----------------------------------------------------------------------
14 int main(int argc, char** argv)
15 {
16  QApplication app(argc, argv);
17  QLabel lbl1("Animated Window1");
18  QLabel lbl2("Animated Window2");
19 
20  QPropertyAnimation* panim1 = new QPropertyAnimation(&lbl1, "geometry");
21  panim1->setDuration(3000);
22  panim1->setStartValue(QRect(120, 0, 100, 100));
23  panim1->setEndValue(QRect(480, 380, 200, 200));
24  panim1->setEasingCurve(QEasingCurve::InOutExpo);
25 
26  QPropertyAnimation* panim2 = new QPropertyAnimation(&lbl2, "pos");
27  panim2->setDuration(3000);
28  panim2->setStartValue(QPoint(240, 0));
29  panim2->setEndValue(QPoint(240, 480));
30  panim2->setEasingCurve(QEasingCurve::OutBounce);
31 
32  QParallelAnimationGroup group;
33  group.addAnimation(panim1);
34  group.addAnimation(panim2);
35  group.setLoopCount(3);
36  group.start();
37 
38  lbl1.show();
39  lbl2.show();
40 
41  return app.exec();
42 }
int main(int argc, char **argv)
Definition: main.cpp:15