Skip to content

Commit d77ce93

Browse files
committed
Merge pull request #165 from dakcarto/fix-menus-two
Fixes for issues #5753 and #5754
2 parents 769fd5e + 7f1a4e2 commit d77ce93

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-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

+15-3
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,12 @@ void QgisApp::createActions()
928928
connect( mActionCustomization, SIGNAL( triggered() ), this, SLOT( customize() ) );
929929

930930
#ifdef Q_WS_MAC
931+
// copy of Options action that gets moved to app Preferences...
932+
mActionOptionsMac = new QAction( mActionOptions->text(), this );
933+
mActionOptionsMac->setMenuRole( QAction::NoRole );
934+
mActionOptionsMac->setIcon( mActionOptions->icon() );
935+
connect( mActionOptionsMac, SIGNAL( triggered() ), this, SLOT( options() ) );
936+
931937
// Window Menu Items
932938

933939
mActionWindowMinimize = new QAction( tr( "Minimize" ), this );
@@ -1158,16 +1164,22 @@ void QgisApp::createMenus()
11581164
}
11591165

11601166
#ifdef Q_WS_MAC
1167+
// copy back the Options action after assigned to app Preferences...
1168+
mSettingsMenu->addAction( mActionOptionsMac );
1169+
11611170
// Window Menu
11621171

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

11651174
mWindowMenu->addAction( mActionWindowMinimize );
11661175
mWindowMenu->addAction( mActionWindowZoom );
11671176
mWindowMenu->addSeparator();
11681177

11691178
mWindowMenu->addAction( mActionWindowAllToFront );
11701179
mWindowMenu->addSeparator();
1180+
1181+
// insert before Help menu, as per Mac OS convention
1182+
menuBar()->insertMenu( mHelpMenu->menuAction(), mWindowMenu );
11711183
#endif
11721184

11731185
// Database Menu
@@ -5784,7 +5796,7 @@ void QgisApp::addPluginToDatabaseMenu( QString name, QAction* action )
57845796
before = actions.at( i );
57855797
break;
57865798
}
5787-
else if ( actions.at( i )->menu() == mHelpMenu )
5799+
else if ( actions.at( i )->menu() == firstRightStandardMenu() )
57885800
{
57895801
before = actions.at( i );
57905802
break;
@@ -5846,7 +5858,7 @@ void QgisApp::addPluginToWebMenu( QString name, QAction* action )
58465858
{
58475859
if ( actions.at( i )->menu() == mWebMenu )
58485860
return;
5849-
if ( actions.at( i )->menu() == mHelpMenu )
5861+
if ( actions.at( i )->menu() == firstRightStandardMenu() )
58505862
{
58515863
before = actions.at( i );
58525864
break;

src/app/qgisapp.h

+1
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
978978
// actions for menus and toolbars -----------------
979979

980980
#ifdef Q_WS_MAC
981+
QAction *mActionOptionsMac;
981982
QAction *mActionWindowMinimize;
982983
QAction *mActionWindowZoom;
983984
QAction *mActionWindowSeparator1;

src/ui/qgisapp.ui

+3
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,9 @@
13781378
<property name="text">
13791379
<string>Configure shortcuts...</string>
13801380
</property>
1381+
<property name="menuRole">
1382+
<enum>QAction::NoRole</enum>
1383+
</property>
13811384
</action>
13821385
<action name="mActionLocalHistogramStretch">
13831386
<property name="icon">

0 commit comments

Comments
 (0)