Skip to content

Commit 87c3a86

Browse files
committed
Allow plugins to add actions to top level of raster/vector/db/web menus
Provides a way to avoid plugins creating submenus with a single action - e.g. "DB Manager" -> "DB Manager". It's a violation of HIG to have a submenu with a single action contained in it.
1 parent d0c14ef commit 87c3a86

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎src/app/qgisapp.cpp‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10963,6 +10963,9 @@ void QgisApp::removePluginMenu( const QString &name, QAction *action )
1096310963

1096410964
QMenu *QgisApp::getDatabaseMenu( const QString &menuName )
1096510965
{
10966+
if ( menuName.isEmpty() )
10967+
return mDatabaseMenu;
10968+
1096610969
QString cleanedMenuName = menuName;
1096710970
#ifdef Q_OS_MAC
1096810971
// Mac doesn't have '&' keyboard shortcuts.
@@ -11004,6 +11007,9 @@ QMenu *QgisApp::getDatabaseMenu( const QString &menuName )
1100411007

1100511008
QMenu *QgisApp::getRasterMenu( const QString &menuName )
1100611009
{
11010+
if ( menuName.isEmpty() )
11011+
return mRasterMenu;
11012+
1100711013
QString cleanedMenuName = menuName;
1100811014
#ifdef Q_OS_MAC
1100911015
// Mac doesn't have '&' keyboard shortcuts.
@@ -11055,6 +11061,9 @@ QMenu *QgisApp::getRasterMenu( const QString &menuName )
1105511061

1105611062
QMenu *QgisApp::getVectorMenu( const QString &menuName )
1105711063
{
11064+
if ( menuName.isEmpty() )
11065+
return mVectorMenu;
11066+
1105811067
QString cleanedMenuName = menuName;
1105911068
#ifdef Q_OS_MAC
1106011069
// Mac doesn't have '&' keyboard shortcuts.
@@ -11096,6 +11105,9 @@ QMenu *QgisApp::getVectorMenu( const QString &menuName )
1109611105

1109711106
QMenu *QgisApp::getWebMenu( const QString &menuName )
1109811107
{
11108+
if ( menuName.isEmpty() )
11109+
return mWebMenu;
11110+
1109911111
QString cleanedMenuName = menuName;
1110011112
#ifdef Q_OS_MAC
1110111113
// Mac doesn't have '&' keyboard shortcuts.

0 commit comments

Comments
 (0)