Bug report #9134
customization menu doesn't work
|Affected QGIS version:||2.0.1||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||17769|
It is not possible to customize single entries of the menu bar. For example trying to remove "geoprocessing" and "geometry" in the "Vector" menu, after the reboot, the entries are still there. Same problem with all the menus, but it works fine with the panels button.
#1 Updated by Radim Blazek over 6 years ago
Customization only works for objects with objectName. objectName is automatically set by Qt for objects created in designer (compiled from .ui). For objects created programmatically it has to be set. I have added object names to fTools in d334b46, but they have to be added in all plugins.
Recommendation for plugin authors: when you are adding QMenu or QAction, always set its object name, e.g.:
myMenu = QMenu('My menu") myMenu.setObjectName("myMenu")
#5 Updated by Radim Blazek over 6 years ago
I added objectName to all core C++ plugins in 0f590db.
Also various QgisApp::get*Menu() (used by changed to addPluginTo*Menu()) changed to set always the objectName to at least normalizedMenuName() of menu title. That is not perfect because the titles are translated. We have to add an objectName param to addPluginTo*Menu() functions.
#6 Updated by Radim Blazek over 6 years ago
Remaining objectName added also in Python plugins in 748ff8b2.
The "Processing" menu still does not work. QgisApp::instance()->menuBar() in QgsCustomization::createTreeItemMenus() somehow does not contain the menu previously added by Processing plugin:
I tried to change
QWidget * QgisInterface::mainWindow()
QMainWindow * QgisInterface::mainWindow()
but it does not help.