diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-04-05 11:21:29 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-04-14 08:47:53 +0000 |
commit | 1457df74f4c1d770e1e820de8cd082be1bd2489e (patch) | |
tree | 9a6a637ee9304607e0cab1163db9c4c9479f0352 /src/quick/items/qquickitem.h | |
parent | 70513c7496dabf504132dd5c900cd85b367bd1b7 (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 'src/quick/items/qquickitem.h')
-rw-r--r-- | src/quick/items/qquickitem.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 1d174ca979..b7a25581a7 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -292,6 +292,8 @@ public: void setAcceptedMouseButtons(Qt::MouseButtons buttons); bool acceptHoverEvents() const; void setAcceptHoverEvents(bool enabled); + bool acceptTouchEvents() const; + void setAcceptTouchEvents(bool accept); #if QT_CONFIG(cursor) QCursor cursor() const; |