diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-21 11:14:29 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-12-22 07:25:04 +0000 |
commit | e3e0240c7798009d5cce9c4897b906fbce40dd24 (patch) | |
tree | 4aed60e155dd3f71b0bc428f6a9daa5825b199fc /src/gui/kernel/qevent.h | |
parent | feea236d92656ef1a7cd2b94e3f3ca99c19f4e96 (diff) |
QGraphicsScene: prevent lots of detaching d/t editing of copies
QTouchEvent::touchPoints() returns a const-&, but the old
code took a copy, over which it then iterated, modifying
the touch points, causing (necessary) detaches of both the
list and the touch points.
Befriend QTouchEvent and modify the list in-place, avoiding
all detaches in the likely case that QTouchPoint contains the
only copy of the touch point list.
This is all the more important as the function is called once
for every item-under-mouse in sendTouchBeginEvent().
Port to C++11 range-for as a drive-by.
Change-Id: I2f74d19845711d97e3566886123b5d18d55db74c
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r-- | src/gui/kernel/qevent.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 66e650c42d..cd65485397 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -908,6 +908,9 @@ protected: friend class QGuiApplicationPrivate; friend class QApplication; friend class QApplicationPrivate; +#ifndef QT_NO_GRAPHICSVIEW + friend class QGraphicsScenePrivate; // direct access to _touchPoints +#endif }; Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE); Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags) |