Skip to content

Commit f01c6ad

Browse files
committedJun 10, 2012
Simple fix for #5754 (Mac OS-specific). Better fix would be to make a method that set all QAction additions to base menus (submenus ok) to QAction::NoRole. This would keep any new action from hijacking the Mac app's About or Preferences… menus.
See: http://doc.qt.nokia.com/4.7.1/qmenubar.html#qmenubar-on-mac-os-x
1 parent 769fd5e commit f01c6ad

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 9 additions & 0 deletions
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,6 +1164,9 @@ 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

11631172
mWindowMenu = menuBar()->addMenu( tr( "&Window" ) );

‎src/app/qgisapp.h

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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)
Please sign in to comment.