#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
#include <QWidget> #include <QPropertyAnimation> #include <QEasingCurve> class MyWidget : public QWidget { public : MyWidget(QObject* parent = 0); // MyWidget fields and methods public slots: void startAnimation(); private : QPropertyAnimation* _propertyAnimation; }; * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- MyWidget :: MyWidget (QObject * parent): QWidget (parent) {
- // Widget initialization
- _propertyAnimation = new QPropertyAnimation ( this , "geometry" );
- _propertyAnimation-> setDuration (1000);
- _propertyAnimation-> setEasingCurve (QEasingCurve :: OutCubic);
- }
- void MyWidget :: startAnimation () {
- QRectF firstPosition;
- QRectF endPosition;
- // Initializing first and end values
- _propertyAnimation-> setFirstValue (firstPosition);
- _propertyAnimation-> setEndValue (endPosition);
- _propertyAnimation-> start ();
- }
Source: https://habr.com/ru/post/75671/
All Articles