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

QMenu::activeAction() unexpectedly resets to nullptr after setActiveAction()

XMLWordPrintable

    • Windows

      When using QMenu::setActiveAction() followed by a delayed call to QMenu::activeAction(), the result is inconsistent depending on the number of actions in the menu.

      With 3 actions, the final call returns the last set action (as expected):

      Active Action: QAction("Item 1")
      Active Action: QAction("Item 2")
      Active Action: QAction("Item 3")
      Active Action: QAction("Item 3")
      But with only 2 actions, the final call unexpectedly returns Null Ptr
      Active Action: QAction("Item 1")
      Active Action: QAction("Item 2")
      Active Action: QAction(0x0)

      Above result can be seen with attached example. It is observed that problem occurs when we change from an action with submenu to an action without submenu

       

        1. qtbug138956.zip
          1 kB
          Irfan Omair
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            irfan.omair@digia.com Irfan Omair
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes