Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
qmenu actions don't show
Jakob last edited by
I created a class that derives from
QMenu, and have the constructor call the
QMenuconstructor 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:
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
QApplicationobject 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?
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.