aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-07-15 13:19:22 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2016-07-15 18:34:23 +0000
commit1b0a6a073e5b79121606312ac3fcfd267ba462ae (patch)
treebc7621602605e021214969a99a58a34bf432d79c /src/quick/items/qquickevents.cpp
parent288c1425d6e3ac200dd8e687f13de6ce4a41260b (diff)
Add QQuickPointerEvent::allPointsAccepted
Convenience method to decide if the event is completely accepted or further delivery makes sense. Change-Id: I389a975cca2966962848203f69ec7f2e307a210a Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/quick/items/qquickevents.cpp')
-rw-r--r--src/quick/items/qquickevents.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 911cc9a52c..d7b1f7573b 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -573,6 +573,21 @@ const QQuickEventPoint *QQuickPointerEvent::point(int i) const {
return nullptr;
}
+bool QQuickPointerEvent::allPointsAccepted() const
+{
+ Q_ASSERT(m_event && !isTabletEvent());
+ if (isMouseEvent()) {
+ return m_mousePoint->isAccepted();
+ }
+ if (isTouchEvent()) {
+ for (int i = 0; i < m_pointCount; ++i) {
+ if (!m_touchPoints.at(i)->isAccepted())
+ return false;
+ }
+ }
+ return true;
+}
+
/*!
\internal
Populate the reusable synth-mouse event from one touchpoint.