Let's apply what we learned about the Qt Animation framework to our project. Each time the user clicks on a filter thumbnail, we want to poke it. All modifications will be done on the FilterWidget class. Let's start with FilterWidget.h:
#include <QPropertyAnimation> class FilterWidget : public QWidget { Q_OBJECT public: explicit FilterWidget(Filter& filter, QWidget *parent = 0); ~FilterWidget(); ... private: void initAnimations(); void startSelectionAnimation(); ... QPropertyAnimation mSelectionAnimation; };
The first function, initAnimations(), initializes the animations used by FilterWidget. The second function, startSelectionAnimation(), performs tasks required to start this animation correctly. As you can see, we are also using a QPropertyAnimation type, as covered in the previous...