Bug report #9134
customization menu doesn't work
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Radim Blazek | ||
Category: | Customisation Framework | ||
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 |
Description
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.
Associated revisions
fixed processing plugin customization (thanks to Martin Dobias), fixes #9134
History
#1 Updated by Radim Blazek almost 11 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")
#2 Updated by matteo ghetta almost 11 years ago
- % Done changed from 0 to 50
- Assignee set to Radim Blazek
Hi Radim,
thanks for your work, well done!
Now it is possible to customize entirely the Vector menu. Do you plan to do the same work with the Raster menu?
#3 Updated by Radim Blazek almost 11 years ago
matteo ghetta wrote:
Do you plan to do the same work with the Raster menu?
Not really. Could you create pull request?
#4 Updated by matteo ghetta almost 11 years ago
I'm not able to write that code, sorry...
Maybe someone else can help with this issue, I think it wouldn't take much time for a skilled person.
#5 Updated by Radim Blazek almost 11 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 10 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:
menuBar.insertMenu(interface.iface.firstRightStandardMenu().menuAction(),self.menu)
I tried to change
QWidget * QgisInterface::mainWindow()
to
QMainWindow * QgisInterface::mainWindow()
but it does not help.
#7 Updated by Radim Blazek over 10 years ago
- Status changed from Open to Closed
Fixed in changeset a43bd626affae00d721a26c23efbf3e3003ab4cc.