@@ -5953,22 +5953,31 @@ void QgisApp::addPluginToDatabaseMenu( QString name, QAction* action )
5953
5953
{
5954
5954
if ( actions.at ( i )->menu () == mDatabaseMenu )
5955
5955
return ;
5956
+
5957
+ // goes before Web menu, if present
5956
5958
if ( actions.at ( i )->menu () == mWebMenu )
5957
5959
{
5958
5960
before = actions.at ( i );
5959
5961
break ;
5960
5962
}
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 )
5962
5968
{
5963
- before = actions.at ( i );
5964
- break ;
5969
+ if ( !before )
5970
+ {
5971
+ before = actions.at ( i += 1 );
5972
+ break ;
5973
+ }
5965
5974
}
5966
5975
}
5967
-
5968
5976
if ( before )
5969
5977
menuBar ()->insertMenu ( before, mDatabaseMenu );
5970
5978
else
5971
- menuBar ()->addMenu ( mDatabaseMenu );
5979
+ // fallback insert
5980
+ menuBar ()->insertMenu ( firstRightStandardMenu ()->menuAction (), mDatabaseMenu );
5972
5981
}
5973
5982
5974
5983
void QgisApp::addPluginToRasterMenu ( QString name, QAction* action )
@@ -5992,6 +6001,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
5992
6001
{
5993
6002
if ( actions.at ( i )->menu () == mVectorMenu )
5994
6003
return ;
6004
+
6005
+ // goes before Raster menu, which is already in qgisapp.ui
5995
6006
if ( actions.at ( i )->menu () == mRasterMenu )
5996
6007
{
5997
6008
before = actions.at ( i );
@@ -6002,7 +6013,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
6002
6013
if ( before )
6003
6014
menuBar ()->insertMenu ( before, mVectorMenu );
6004
6015
else
6005
- menuBar ()->addMenu ( mVectorMenu );
6016
+ // fallback insert
6017
+ menuBar ()->insertMenu ( firstRightStandardMenu ()->menuAction (), mVectorMenu );
6006
6018
}
6007
6019
6008
6020
void QgisApp::addPluginToWebMenu ( QString name, QAction* action )
@@ -6018,19 +6030,34 @@ void QgisApp::addPluginToWebMenu( QString name, QAction* action )
6018
6030
QList<QAction*> actions = menuBar ()->actions ();
6019
6031
for ( int i = 0 ; i < actions.count (); i++ )
6020
6032
{
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
+
6021
6040
if ( actions.at ( i )->menu () == mWebMenu )
6022
6041
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 )
6024
6047
{
6025
- before = actions.at ( i );
6026
- break ;
6048
+ if ( !before )
6049
+ {
6050
+ before = actions.at ( i += 1 );
6051
+ break ;
6052
+ }
6027
6053
}
6028
6054
}
6029
6055
6030
6056
if ( before )
6031
6057
menuBar ()->insertMenu ( before, mWebMenu );
6032
6058
else
6033
- menuBar ()->addMenu ( mWebMenu );
6059
+ // fallback insert
6060
+ menuBar ()->insertMenu ( firstRightStandardMenu ()->menuAction (), mWebMenu );
6034
6061
}
6035
6062
6036
6063
void QgisApp::removePluginDatabaseMenu ( QString name, QAction* action )
0 commit comments