Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16346

Impossible to detect "QMenu dismissed without activating any items" event.

    XMLWordPrintable

Details

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jart Joseph Artsimovich
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes