Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qmenu actions don't show
Qt 6.11 is out! See what's new in the release blog

qmenu actions don't show

Scheduled Pinned Locked Moved General and Desktop
qt5 windows7
2 Posts 2 Posters 1.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jakob
    wrote on last edited by
    #1

    I created a class that derives from QMenu, and have the constructor call the QMenu constructor with no parent, i.e. QMenu("Title"). Then inside the derived class I add actions to the menu, by calling addAction("Action title") a view times. Then an instance of this class is added to the menu bar in my main window:

    menu->setParent(mainWindow); addMenu(&menu)

    Expected: result: the menu shows with all the actions.
    Actual result: only the menu title shows, but no actions.
    Interestingly if I don't reparent, the actions do show up.

    However: the menu is created from within a separate plugin. When I don't reparent, the application crashes upon exit, apparently because by default the application object is the parent of the menu instead of the menu bar. The crash happens because the module is unloaded before the QApplication object is destructed, and because only then the menu gets destructed, it tries to call a destructor that is not available anymore (because it resides in the plugin)

    How do I fix this?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Your design reminds me of the Plug & Paint example and its friends. You should take a look at them to see if you can grab something to fix your issue.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved