Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12
-
None
-
-
8ada0633cd58e0608df2e16880f1293286025504
Description
Run the attached sample.
Swipe the finger vertically and release it.
You should get a log similar to this, where we get two TouchBegin events in the beginning...
2.968 main.cpp(115):TouchBegin 2.969 main.cpp(115):MouseMove (MouseEventSynthesizedByQt) 2.973 main.cpp(115):TouchBegin 2.973 main.cpp(115):MouseButtonPress (MouseEventSynthesizedByQt) 2.974 main.cpp(115):TouchUpdate 2.974 main.cpp(115):MouseMove (MouseEventSynthesizedByQt) 2.985 main.cpp(115):TouchUpdate 2.986 main.cpp(115):MouseMove (MouseEventSynthesizedByQt) [....] 3.368 main.cpp(115):TouchUpdate 3.371 main.cpp(115):MouseMove (MouseEventSynthesizedByQt) 3.393 main.cpp(115):TouchUpdate 3.397 main.cpp(115):MouseMove (MouseEventSynthesizedByQt) 3.421 main.cpp(115):MouseMove (MouseEventSynthesizedByQt) 3.425 main.cpp(115):TouchEnd 3.429 main.cpp(115):MouseButtonRelease (MouseEventSynthesizedByQt)
The first one seems to be wrong. It is actually because the actual system event is WM_POINTERENTER. And when QWindowsPointerHandler::translateTouchEvent() delivers the touch event it deduces the type of touch event by examining the state of the touchpoints. So the touch event will be ultimately be delivered as TouchBegin.
Next, it will try to deliver the mouse event, but the call to getMouseEventInfo() results in that eventType becomes QEvent::None. That type is passed on to QWindowSystemInterface::handleMouseEvent(), and it will eventually end up in QGuiApplicationPrivate::processMouseEvent(), and deduce that the event should be of type QEvent::MouseMove. This is why the first two events are TouchBegin and MouseMove. I believe they should not be there.
Maybe the call to translateTouchEvent() in QWindowsPointerHandler::translatePointerEvent() should be surrounded by check on the msg.message instead of just checking the pointerType. It seems that translateTouchEvent() should only be responsible for sending TouchBegin TouchUpdate TouchEnd (or MousePress, MouseMove, MouseRelease) events.