qmenu actions don't show
-
I created a class that derives from
QMenu
, and have the constructor call theQMenu
constructor with no parent, i.e.QMenu("Title")
. Then inside the derived class I add actions to the menu, by callingaddAction("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?
-
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.