Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.3
-
None
Description
ApplicationPrivate::mouse_buttons is the variable which track the system mouse button state. it will be updated when spontaneous QEvent::MouseButtonPress and QEvent::MouseButtonRelease event is sent to Qt. During a dnd operation, only the QEvent::MouseButtonPress is sent to Qt, and it will set Qt::LeftButton flag in QApplicationPrivate::mouse_buttons,but the QEvent::MouseButtonRelease event was never sent to Qt after the dnd operation ( it was eat by window system), this will leave QApplicationPrivate::mouse_buttons in a wrong state.
In general, this will not cause any problem, because the next mouse click by user will correct the state in QApplicationPrivate::mouse_buttons. But I have encountered an anoying issue caused by this problem:
After a dnd operation I created a child tool button widget in the widget who receive the drop, and the mouse pointer is in the rectangle of the child tool button widget, and when Qt call setVisible() for the child tool button widget it will call a funtion called QApplicationPrivate::sendSyntheticEnterLeave(), this function will simulate mouse enter/move/leave for the widget under the mouse pointer and it will use QApplicationPrivate::mouse_buttons to construct the QMouseEvent object, but at this time the QApplicationPrivate::mouse_buttons is in a wrong state, it will finally cause the child tool button widget repaint itself as in a pressed down state which looks obviously wrong.