Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
-
Linux desktop, X11
-
I8518b06c4ce86ea7b35120e3353a45ea2a81d356
Description
A testcase like the attached one, which sends a mouse event to a QWidget using QTest::mouseClick, used to adjust QApplication::keyboardModifiers() in Qt4, but doesn't do so anymore in Qt5.
It seems the code that changes modifier_buttons is now in QGuiApplicationPrivate::processMouseEvent, which is not called by QTest::mouseClick.
qapplication.cpp:2983 (which is called) says
// capture the current mouse/keyboard state
but it only captures the mouse state, not the keyboard state.
Should it capture keyboard state again, like in Qt4?
But the interesting thing in all this is that outside of unit tests, it's all working fine (when I click on an actual widget, QApplication::keyboardModifiers() is set).
So maybe the real fix would be that QTest::mouseClick works more like a real mouse click, going via the QWindow first, before being sent to the target QWidget? Not sure what this means exactly in terms of code changes though.
Attachments
Issue Links
- relates to
-
QTBUG-92196 Discrepancy between user input and simulated test input when clicking shift key
- Reported