Skip to content

Commit 7f1a4e2

Browse files
committed
Fix for #5753
Does not address third-party plugins that add their own menus. They should use (here for Python): menu_bar = self.iface.mainWindow().menuBar() menu_bar.insertMenu( self.iface.firstRightStandardMenu().menuAction(), self.my_plugins_menu ) Ideally, a new QgisInterface public slot pair of addMenuToMenuBar(QMenu)/removeMenuFromMenuBar(QMenu) should be added, to help plugin developers put their menus in the correct place. Deletion in GdalTools.py is redundant add-to-menu code. It moved the Raster menu to -1 on the menubar (between Window and Help on Mac).
1 parent f01c6ad commit 7f1a4e2

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

python/plugins/GdalTools/GdalTools.py

-5
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,6 @@ def initGui( self ):
264264
QObject.connect( self.settings, SIGNAL( "triggered()" ), self.doSettings )
265265
self.menu.addAction( self.settings )
266266

267-
menu_bar = self.iface.mainWindow().menuBar()
268-
actions = menu_bar.actions()
269-
lastAction = actions[ len( actions ) - 1 ]
270-
menu_bar.insertMenu( lastAction, self.menu )
271-
272267
def unload( self ):
273268
if not valid: return
274269
pass

src/app/qgisapp.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,17 @@ void QgisApp::createMenus()
11691169

11701170
// Window Menu
11711171

1172-
mWindowMenu = menuBar()->addMenu( tr( "&Window" ) );
1172+
mWindowMenu = new QMenu( tr( "Window" ), this );
11731173

11741174
mWindowMenu->addAction( mActionWindowMinimize );
11751175
mWindowMenu->addAction( mActionWindowZoom );
11761176
mWindowMenu->addSeparator();
11771177

11781178
mWindowMenu->addAction( mActionWindowAllToFront );
11791179
mWindowMenu->addSeparator();
1180+
1181+
// insert before Help menu, as per Mac OS convention
1182+
menuBar()->insertMenu( mHelpMenu->menuAction(), mWindowMenu );
11801183
#endif
11811184

11821185
// Database Menu
@@ -5793,7 +5796,7 @@ void QgisApp::addPluginToDatabaseMenu( QString name, QAction* action )
57935796
before = actions.at( i );
57945797
break;
57955798
}
5796-
else if ( actions.at( i )->menu() == mHelpMenu )
5799+
else if ( actions.at( i )->menu() == firstRightStandardMenu() )
57975800
{
57985801
before = actions.at( i );
57995802
break;
@@ -5855,7 +5858,7 @@ void QgisApp::addPluginToWebMenu( QString name, QAction* action )
58555858
{
58565859
if ( actions.at( i )->menu() == mWebMenu )
58575860
return;
5858-
if ( actions.at( i )->menu() == mHelpMenu )
5861+
if ( actions.at( i )->menu() == firstRightStandardMenu() )
58595862
{
58605863
before = actions.at( i );
58615864
break;

0 commit comments

Comments
 (0)