aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/touchmouse
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-04-05 11:21:29 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2017-04-14 08:47:53 +0000
commit1457df74f4c1d770e1e820de8cd082be1bd2489e (patch)
tree9a6a637ee9304607e0cab1163db9c4c9479f0352 /tests/auto/quick/touchmouse
parent70513c7496dabf504132dd5c900cd85b367bd1b7 (diff)
Add QQuickItem acceptTouchEvents/setAcceptTouchEvents; require for touch
It has been suboptimal to speculatively deliver touch events to Items which are not interested; even worse is when we must deliver to a parent item which is filtering events, when the child Item will not accept the touch event anyway. So now it is required that any QQuickItem subclass which wishes to accept touch events must call setAcceptTouchEvents(true) (typically in its constructor). If it does not do this, it will not get any touch events (and this saves us the trouble of looking for parents which filter touch events, too). It is consistent with needing to call setAcceptHoverEvents() to get hover events, and setAcceptedMouseButtons() to get mouse events. [ChangeLog][QtQuick][QQuickItem] When subclassing QQuickItem, it is now required to call setAcceptTouchEvents(true) if you need the item to receive touch events. Change-Id: Idc76c04f4e7f1d4a613087e756e96dac368f4f23 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/touchmouse')
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 6e7fce6189..6f5c9a37d5 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -74,6 +74,7 @@ public:
: QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1)
{
setAcceptedMouseButtons(Qt::LeftButton);
+ setAcceptTouchEvents(true);
}
void touchEvent(QTouchEvent *event)