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>
This commit is contained in:
Shawn Rutledge 2021-12-02 22:20:51 +01:00
parent b89608dcf8
commit af987c1bde

View File

@ -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