Details
-
Suggestion
-
Resolution: Unresolved
-
P4: Low
-
None
-
None
Description
I have a menu that's part of a state machine. Displaying a menu corresponds to a certain state. Activating a menu item switches it to another state. Dismissing a menu without activating any items switches it to yet another state. The problem is that it's not possible to reliably detect "dismissed without activating any items" event, at least when using the non-blocking mode with show() rather than exec(). The problem is that QMenu::aboutToHide() signal is emitted before QAction::triggered(), so having received aboutToHide signal you are left wondering, whether QAction::triggered() will follow or not. On Windows and Linux I can workaround this limitation by putting aboutToHide on a queued connection, forcing it to go after QAction::triggered(). On MacOSX it doesn't help though, as QAction::triggered() is emitted significantly (~150ms) later than QMenu::aboutToHide().
I think we need a separate signal to indicate "dismissed without activating any items" event.