Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12.7, 5.14.1
-
-
d934fd7f54eae24ea3f719890e2c4dbbc445049d (qt/qtbase/5.14)
-
Shovelling Snow, Q1/2020 Finale
Description
This erroneous scenario involves dismissing a context menu that is shown from a Qt:Popup window. (i.e. two levels of Qt::Popup).
When one dismisses a context menu shown from a Qt::Popup window by clicking away from it, the mousePressEvent is delivered to the popup, processed to close the popup, but the remaining events are delivered to the next widget with focus.
Those remaining events are
- 1-4 mouseMoveEvents with Qt::LeftButton held
- a mouseReleaseEvent for Qt::LeftButton
This is undocumented behavior inĀ https://doc.qt.io/qt-5.12/qwidget.html#events and it causes problems due to the focus widget getting drag events even though the user never started a drag event in that widget.
See attached simple example that reproduces the problem.
To reproduce:
- Start the app
- Right click in the app to bring up the custom Qt::Popup window with label "Right click to bring up context menu, then click in this window to dismiss it."
- As the label says, right click to bring up it's context menu, then click away from it but within the bounds of the custom Qt::Popup.
See the events logged in the MainWindow and in the console.
It is set up to log messages for each of the mousePress, mouseMove, and mouseReleaseEvents - but only mouseMove (with LMB held) and mouseReleaseEvents are received by the PopupWindow.
The behavior is better when the PopupWindow has the Qt::Dialog WindowType flag - in that case, the PopupWindow receives the mousePressEvent for the LMB along with the rest of the expected events above.
Problem verified on windows - haven't tested macOS or Linux yet.
Attachments
Issue Links
- resulted in
-
QTBUG-84926 [REG 5.14->5.15] Can't quickly open an action from QMenu using a mouse
- Closed