Skip to content

Commit 1d8ed46

Browse files
committed
Merge branch 'fix-menu-ordering-2' of https://github.com/dakcarto/Quantum-GIS into 5753
2 parents 02b1324 + de6f642 commit 1d8ed46

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

src/app/qgisapp.cpp

+37-10
Original file line numberDiff line numberDiff line change
@@ -5953,22 +5953,31 @@ void QgisApp::addPluginToDatabaseMenu( QString name, QAction* action )
59535953
{
59545954
if ( actions.at( i )->menu() == mDatabaseMenu )
59555955
return;
5956+
5957+
// goes before Web menu, if present
59565958
if ( actions.at( i )->menu() == mWebMenu )
59575959
{
59585960
before = actions.at( i );
59595961
break;
59605962
}
5961-
else if ( actions.at( i )->menu() == firstRightStandardMenu() )
5963+
}
5964+
for ( int i = 0; i < actions.count(); i++ )
5965+
{
5966+
// defaults to after Raster menu, which is already in qgisapp.ui
5967+
if ( actions.at( i )->menu() == mRasterMenu )
59625968
{
5963-
before = actions.at( i );
5964-
break;
5969+
if ( !before )
5970+
{
5971+
before = actions.at( i += 1 );
5972+
break;
5973+
}
59655974
}
59665975
}
5967-
59685976
if ( before )
59695977
menuBar()->insertMenu( before, mDatabaseMenu );
59705978
else
5971-
menuBar()->addMenu( mDatabaseMenu );
5979+
// fallback insert
5980+
menuBar()->insertMenu( firstRightStandardMenu()->menuAction(), mDatabaseMenu );
59725981
}
59735982

59745983
void QgisApp::addPluginToRasterMenu( QString name, QAction* action )
@@ -5992,6 +6001,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
59926001
{
59936002
if ( actions.at( i )->menu() == mVectorMenu )
59946003
return;
6004+
6005+
// goes before Raster menu, which is already in qgisapp.ui
59956006
if ( actions.at( i )->menu() == mRasterMenu )
59966007
{
59976008
before = actions.at( i );
@@ -6002,7 +6013,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
60026013
if ( before )
60036014
menuBar()->insertMenu( before, mVectorMenu );
60046015
else
6005-
menuBar()->addMenu( mVectorMenu );
6016+
// fallback insert
6017+
menuBar()->insertMenu( firstRightStandardMenu()->menuAction(), mVectorMenu );
60066018
}
60076019

60086020
void QgisApp::addPluginToWebMenu( QString name, QAction* action )
@@ -6018,19 +6030,34 @@ void QgisApp::addPluginToWebMenu( QString name, QAction* action )
60186030
QList<QAction*> actions = menuBar()->actions();
60196031
for ( int i = 0; i < actions.count(); i++ )
60206032
{
6033+
// goes after Database menu, if present
6034+
if ( actions.at( i )->menu() == mDatabaseMenu )
6035+
{
6036+
before = actions.at( i += 1 );
6037+
// don't break here
6038+
}
6039+
60216040
if ( actions.at( i )->menu() == mWebMenu )
60226041
return;
6023-
if ( actions.at( i )->menu() == firstRightStandardMenu() )
6042+
}
6043+
for ( int i = 0; i < actions.count(); i++ )
6044+
{
6045+
// defaults to after Raster menu, which is already in qgisapp.ui
6046+
if ( actions.at( i )->menu() == mRasterMenu )
60246047
{
6025-
before = actions.at( i );
6026-
break;
6048+
if ( !before )
6049+
{
6050+
before = actions.at( i += 1 );
6051+
break;
6052+
}
60276053
}
60286054
}
60296055

60306056
if ( before )
60316057
menuBar()->insertMenu( before, mWebMenu );
60326058
else
6033-
menuBar()->addMenu( mWebMenu );
6059+
// fallback insert
6060+
menuBar()->insertMenu( firstRightStandardMenu()->menuAction(), mWebMenu );
60346061
}
60356062

60366063
void QgisApp::removePluginDatabaseMenu( QString name, QAction* action )

0 commit comments

Comments
 (0)