diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-02-11 17:42:44 -0200 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-02-11 17:42:44 -0200 |
commit | b722ac36aef378ed9837f7f4595b4ce2d255f4ac (patch) | |
tree | 055558f21a7609c018c71dce82c534c2ae50f242 | |
parent | 7b6e2d60cb24cb3799d94855bb4d5b524ef27cd8 (diff) |
TransitionControl: unhandled events are now ignore()'d.
Added parent parameter to ctor, as with other components.
-rw-r--r-- | transitioncontrol.cpp | 8 | ||||
-rw-r--r-- | transitioncontrol.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/transitioncontrol.cpp b/transitioncontrol.cpp index 6d3f298..ca12e61 100644 --- a/transitioncontrol.cpp +++ b/transitioncontrol.cpp @@ -8,8 +8,9 @@ // The mouse button used for interaction static const Qt::MouseButton MOUSE_BUTTON = Qt::MiddleButton; -TransitionControl::TransitionControl() - : m_t(1.0) +TransitionControl::TransitionControl(QQuickItem *parent) + : QQuickItem(parent) + , m_t(1.0) , m_startPos(-1) , m_shouldRewind(false) { @@ -28,6 +29,7 @@ void TransitionControl::setT(double t) void TransitionControl::mousePressEvent(QMouseEvent *event) { if (event->button() != MOUSE_BUTTON) { + event->ignore(); return; } @@ -39,6 +41,7 @@ void TransitionControl::mouseMoveEvent(QMouseEvent *event) { int x = event->pos().x(); if (!(event->buttons() & MOUSE_BUTTON) || x > m_startPos || x < 0) { + event->ignore(); return; } @@ -50,6 +53,7 @@ void TransitionControl::mouseMoveEvent(QMouseEvent *event) void TransitionControl::mouseReleaseEvent(QMouseEvent *event) { if (event->button() != MOUSE_BUTTON) { + event->ignore(); return; } diff --git a/transitioncontrol.h b/transitioncontrol.h index 4c76e8c..6b15679 100644 --- a/transitioncontrol.h +++ b/transitioncontrol.h @@ -14,7 +14,7 @@ class TransitionControl : { Q_OBJECT public: - TransitionControl(); + TransitionControl(QQuickItem *parent = 0); double t() const { return m_t; } signals: |