From 10950d87f782fd6765ad618e8ebf7909b185fa49 Mon Sep 17 00:00:00 2001 From: Matthias Rauter Date: Thu, 8 Jun 2023 15:44:46 +0200 Subject: [PATCH] Send LeaveEvent as reaction to WM_POINTERLEAVE to reset hover states MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently items can get stuck in a hovered state when all fingers are lifted from a touchscreen. This is because we don't react to the WM_POINTERLEAVE event from Windows. With this patch we translate a WM_POINTERLEAVE event to a LeaveEvent to remove the hover state from QtQuick items. Fixes: QTBUG-62912 Change-Id: I8a6fb6b7ec77457854a75e20277565d1eb89bab6 Reviewed-by: Wladimir Leuschner Reviewed-by: Jan Arve Sæther (cherry picked from commit ef7d809eaf3be2e162a274b48a6ac8051a51e86d) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/windows/qwindowspointerhandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 9592caaabf4..4bd7577cf0c 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -441,6 +441,8 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd, if (id != -1) m_lastTouchPoints.remove(id); } + // Send LeaveEvent to reset hover when the last finger leaves the touch screen (QTBUG-62912) + QWindowSystemInterface::handleEnterLeaveEvent(nullptr, window); } // Only handle down/up/update, ignore others like WM_POINTERENTER, WM_POINTERLEAVE, etc.