Skip to content

Commit

Permalink
Simple fix for #5754 (Mac OS-specific). Better fix would be to make a…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
dakcarto committed Jun 10, 2012
1 parent 769fd5e commit f01c6ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -928,6 +928,12 @@ void QgisApp::createActions()
connect( mActionCustomization, SIGNAL( triggered() ), this, SLOT( customize() ) );

#ifdef Q_WS_MAC
// copy of Options action that gets moved to app Preferences...
mActionOptionsMac = new QAction( mActionOptions->text(), this );
mActionOptionsMac->setMenuRole( QAction::NoRole );
mActionOptionsMac->setIcon( mActionOptions->icon() );
connect( mActionOptionsMac, SIGNAL( triggered() ), this, SLOT( options() ) );

// Window Menu Items

mActionWindowMinimize = new QAction( tr( "Minimize" ), this );
Expand Down Expand Up @@ -1158,6 +1164,9 @@ void QgisApp::createMenus()
}

#ifdef Q_WS_MAC
// copy back the Options action after assigned to app Preferences...
mSettingsMenu->addAction( mActionOptionsMac );

// Window Menu

mWindowMenu = menuBar()->addMenu( tr( "&Window" ) );
Expand Down
1 change: 1 addition & 0 deletions src/app/qgisapp.h
Expand Up @@ -978,6 +978,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
// actions for menus and toolbars -----------------

#ifdef Q_WS_MAC
QAction *mActionOptionsMac;
QAction *mActionWindowMinimize;
QAction *mActionWindowZoom;
QAction *mActionWindowSeparator1;
Expand Down
3 changes: 3 additions & 0 deletions src/ui/qgisapp.ui
Expand Up @@ -1378,6 +1378,9 @@
<property name="text">
<string>Configure shortcuts...</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="mActionLocalHistogramStretch">
<property name="icon">
Expand Down

0 comments on commit f01c6ad

Please sign in to comment.