From e98a2b90b9ab384fce42a7db2e5f7b3f336d1e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 28 Mar 2025 14:22:19 +0100 Subject: [PATCH] Use QLastCursorPosition to check for missing cursor position After c5792dcfd631abb4f9e2b92cd6e88d7e5c373406 the last cursor position is reflected as a QPoint(std::numeric_limits::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 (cherry picked from commit 4ae41c225be57492d5bf0e50c58bf18091414c47) Reviewed-by: Qt Cherry-pick Bot --- src/gui/kernel/qsimpledrag.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index bff1ad482bd..2ca2eca15be 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -195,7 +195,8 @@ void QBasicDrag::startDrag() QPoint pos; #ifndef QT_NO_CURSOR 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... pos = QPoint(); }