I work on and test more QGIS plugins which falls into the same category (lets call it MyProcessing). Though they fall into the same category I want to keep them as separate plugins. I would like to have these plugins in the Plugins menu sharing same menu item (My Processing) and especially sharing the same toolbar (separate from standard plugin toolbar). Is there a way to do that?
In one plugin I create toolbar in interface:
self.toolbar = self.iface.addToolBar(u'MyProcessing')
self.toolbar.setObjectName(u'MyProcessing')
How do I check in other plugin if toolbar MyProcessing exists and add icon into it?
Same with the menu item, is there a way to check if menu item already exists and add other plugin action into it?
Best Answer
Use the
findChild
method of QGISmainWindow
to know if there is aQToolBar
calledu'MyProcessing'
and get it. If you don't get anything, create it.This needs to be checked in each of your plugins. You can then use
myToolBar
to add actions and perhaps a separator to visually group actions (buttons) for each plugin:As you pointed out, reusing menus is explained here: Adding multiple plugins to custom menu in QGIS