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

QMenu::exec stuck in local event loop

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.3
    • GUI: Menus
    • None
    • Windows

    Description

      When calling QMenu::exec() there is a possibility to stuck in the local event loop. E.g.:

      QMenu::exec() internally calls popup(), which actually creates the menu popup and thus leads to focus out event on other widgets. Other widgets could react on this focus out event and e.g. set focus back. This will call QMenu::hideEvent() where the event loop will be exited. After leaving the popup() call, the local event loop gets started, although QMenu::hideEvent() already called.

      Fix would be to not start local event loop in QMenu::exec() when QMenu::hideEvent() already called. E.g. reset d->eventLoop to nullptr in QMenu::hideEvent() and check for nullptr in QMenu::exec() and don't start event loop in that case.

      Attachments

        1. main.cpp
          0.2 kB
        2. mainwindow.cpp
          1.0 kB
        3. mainwindow.h
          0.3 kB
        4. mainwindow.ui
          0.6 kB
        5. QTBUG-80401.pro
          1 kB
        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
            bsikora Björn Sikora
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes