diff options
Diffstat (limited to 'transitioncontrol.h')
-rw-r--r-- | transitioncontrol.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/transitioncontrol.h b/transitioncontrol.h new file mode 100644 index 0000000..ac84786 --- /dev/null +++ b/transitioncontrol.h @@ -0,0 +1,41 @@ +#ifndef TRANSITIONCONTROL_H +#define TRANSITIONCONTROL_H + +#include <QQuickItem> + +/* + * This component emits signals indicating how far from its left edge is the + * mouse since the mouse button was pressed (starting from t == 1.0 with 0.0 + * being exactly at the left edge). As the mouse is released, it emits periodic + * signals incrementing the value until it is restored to the default. + */ +class TransitionControl : + public QQuickItem +{ + Q_OBJECT +public: + TransitionControl(); + double t() const { return m_t; } + +signals: + void tChanged(double t) const; + +public slots: + void setT(double t); + +protected: + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + +private: + double m_t; + + // The x pos where interaction started + int m_startPos; + + // Controls the smooth rewind transition + QThread *m_rewindThread; +}; + +#endif // TRANSITIONCONTROL_H |