From b722ac36aef378ed9837f7f4595b4ce2d255f4ac Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 11 Feb 2016 17:42:44 -0200 Subject: TransitionControl: unhandled events are now ignore()'d. Added parent parameter to ctor, as with other components. --- transitioncontrol.cpp | 8 ++++++-- 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: -- cgit v1.2.3