aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickpointerhandler.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2016-08-22 15:15:58 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2016-08-24 14:27:33 +0000
commitbe763508cf45e34970c9969b49d974061bdb6c92 (patch)
treee349d43ff937e0810faff9acee229afb06343540 /src/quick/handlers/qquickpointerhandler.cpp
parent76c627b1db48390e61d1320d33743447690d3d4d (diff)
add QQuickPointerHandler::active property
By default, a handler is active whenever wantsPointerEvent() returns true, and inactive when it returns false. Change-Id: I627762ba8f4eed167f675f220ffaed79c93c8448 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src/quick/handlers/qquickpointerhandler.cpp')
-rw-r--r--src/quick/handlers/qquickpointerhandler.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp
index 038e7f2571..08a1cfc86f 100644
--- a/src/quick/handlers/qquickpointerhandler.cpp
+++ b/src/quick/handlers/qquickpointerhandler.cpp
@@ -59,6 +59,7 @@ QQuickPointerHandler::QQuickPointerHandler(QObject *parent)
, m_currentEvent(nullptr)
, m_target(nullptr)
, m_enabled(true)
+ , m_active(false)
{
}
@@ -123,7 +124,9 @@ void QQuickPointerHandler::setTarget(QQuickItem *target)
void QQuickPointerHandler::handlePointerEvent(QQuickPointerEvent *event)
{
- if (wantsPointerEvent(event))
+ const bool wants = wantsPointerEvent(event);
+ setActive(wants);
+ if (wants)
handlePointerEventImpl(event);
}
@@ -133,6 +136,14 @@ bool QQuickPointerHandler::wantsPointerEvent(QQuickPointerEvent *event)
return m_enabled;
}
+void QQuickPointerHandler::setActive(bool active)
+{
+ if (m_active != active) {
+ m_active = active;
+ emit activeChanged();
+ }
+}
+
void QQuickPointerHandler::handlePointerEventImpl(QQuickPointerEvent *event)
{
m_currentEvent = event;