PDA

View Full Version : How to add QAction to existing QMenu from menuBar() of QMainWindow?



_Ramirez_
23rd February 2006, 13:07
The problem is that I'm doing this from my pluigin? So how to get QMenu from main app? Plugin should add QAction to this QMenu.

Plugin has QMainWindow parent so it can access its QMenuBar?

wysota
23rd February 2006, 14:43
Your main application should export some interface for the plugin to add its components to the application or your plugin should export some interface for the main application to offer its components. You may access the parents members as usual of course, but you can encounter many problems when trying to change the structure of your app.

_Ramirez_
23rd February 2006, 17:38
I would like to be able to load/unload my plugins at any time. I think it's better that plugins keep track of their actions and remove menu entries when they are unloaded? Main app shouldn't do this.

I'm not sure but I think this can be only done using the first method (app exports interface for plugins). But I have no idea how to do this? Any help?

The other method is used in plugin example from docs. But I don't like it since plugin signals and slots are managed from main app. My app shouldn't have any knowledge of plugins.