diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-12-02 22:20:51 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-12-04 12:23:51 +0000 |
commit | af987c1bde311268cbf7094e3dfefa27ad39e1f9 (patch) | |
tree | d25b84b7304e06dd0ee02f3360cf010bf0f4f6fb /src/gui | |
parent | b89608dcf89ccafa009e2bab480f8fe8c3ee557a (diff) |
doc: Add details about what to use instead of QMouseEvent::source()
Pick-to: 6.2
Fixes: QTBUG-98875
Change-Id: I2678edccf68d754d191b9eb6cdfe09bba327e85a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qevent.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 3c33731279..6617057b42 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -803,6 +803,16 @@ QMouseEvent::~QMouseEvent() \sa Qt::MouseEventSource \sa QGraphicsSceneMouseEvent::source() + + \note In Qt 5-based code, source() was often used to attempt to distinguish + mouse events from an actual mouse vs. those that were synthesized because + some legacy QQuickItem or QWidget subclass did not react to a QTouchEvent. + However, you could not tell whether it was synthesized from a QTouchEvent + or a QTabletEvent, and other information was lost. pointingDevice() + tells you the specific device that it came from, so you might check + \c {pointingDevice()->type()} or \c {pointingDevice()->capabilities()} to + decide how to react to this event. But it's even better to react to the + original event rather than handling only mouse events. */ #if QT_DEPRECATED_SINCE(6, 0) Qt::MouseEventSource QMouseEvent::source() const |