Use QLastCursorPosition to check for missing cursor position

After c5792dcfd631abb4f9e2b92cd6e88d7e5c373406 the last cursor position
is reflected as a QPoint(std::numeric_limits<int>::max(), ...), and
after 209a2145f94e99f99832c3a08cdf579d8f42ca55 as 1 << 23. Instead of
hard coding the sentinel value, let's use QLastCursorPosition directly.

Pick-to: 6.8 6.5
Change-Id: I24031f3cc800d2f0028eb95f4f8597019cc945c0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 4ae41c225be57492d5bf0e50c58bf18091414c47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2025-03-28 14:22:19 +01:00 committed by Qt Cherry-pick Bot
parent 424de984df
commit e98a2b90b9

View File

@ -195,7 +195,8 @@ void QBasicDrag::startDrag()
QPoint pos; QPoint pos;
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
pos = QCursor::pos(); pos = QCursor::pos();
if (pos.x() == int(qInf())) { static constexpr QGuiApplicationPrivate::QLastCursorPosition uninitializedCursorPosition;
if (pos == uninitializedCursorPosition) {
// ### fixme: no mouse pos registered. Get pos from touch... // ### fixme: no mouse pos registered. Get pos from touch...
pos = QPoint(); pos = QPoint();
} }