Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
dakcarto committed Jun 10, 2012
1 parent f01c6ad commit 7f1a4e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 0 additions & 5 deletions python/plugins/GdalTools/GdalTools.py
Expand Up @@ -264,11 +264,6 @@ def initGui( self ):
QObject.connect( self.settings, SIGNAL( "triggered()" ), self.doSettings )
self.menu.addAction( self.settings )

menu_bar = self.iface.mainWindow().menuBar()
actions = menu_bar.actions()
lastAction = actions[ len( actions ) - 1 ]
menu_bar.insertMenu( lastAction, self.menu )

def unload( self ):
if not valid: return
pass
Expand Down
9 changes: 6 additions & 3 deletions src/app/qgisapp.cpp
Expand Up @@ -1169,14 +1169,17 @@ void QgisApp::createMenus()

// Window Menu

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

mWindowMenu->addAction( mActionWindowMinimize );
mWindowMenu->addAction( mActionWindowZoom );
mWindowMenu->addSeparator();

mWindowMenu->addAction( mActionWindowAllToFront );
mWindowMenu->addSeparator();

// insert before Help menu, as per Mac OS convention
menuBar()->insertMenu( mHelpMenu->menuAction(), mWindowMenu );
#endif

// Database Menu
Expand Down Expand Up @@ -5793,7 +5796,7 @@ void QgisApp::addPluginToDatabaseMenu( QString name, QAction* action )
before = actions.at( i );
break;
}
else if ( actions.at( i )->menu() == mHelpMenu )
else if ( actions.at( i )->menu() == firstRightStandardMenu() )
{
before = actions.at( i );
break;
Expand Down Expand Up @@ -5855,7 +5858,7 @@ void QgisApp::addPluginToWebMenu( QString name, QAction* action )
{
if ( actions.at( i )->menu() == mWebMenu )
return;
if ( actions.at( i )->menu() == mHelpMenu )
if ( actions.at( i )->menu() == firstRightStandardMenu() )
{
before = actions.at( i );
break;
Expand Down

0 comments on commit 7f1a4e2

Please sign in to comment.