@@ -5814,22 +5814,31 @@ void QgisApp::addPluginToDatabaseMenu( QString name, QAction* action )
5814
5814
{
5815
5815
if ( actions.at ( i )->menu () == mDatabaseMenu )
5816
5816
return ;
5817
+
5818
+ // goes before Web menu, if present
5817
5819
if ( actions.at ( i )->menu () == mWebMenu )
5818
5820
{
5819
5821
before = actions.at ( i );
5820
5822
break ;
5821
5823
}
5822
- else if ( actions.at ( i )->menu () == firstRightStandardMenu () )
5824
+ }
5825
+ for ( int i = 0 ; i < actions.count (); i++ )
5826
+ {
5827
+ // defaults to after Raster menu, which is already in qgisapp.ui
5828
+ if ( actions.at ( i )->menu () == mRasterMenu )
5823
5829
{
5824
- before = actions.at ( i );
5825
- break ;
5830
+ if ( !before )
5831
+ {
5832
+ before = actions.at ( i += 1 );
5833
+ break ;
5834
+ }
5826
5835
}
5827
5836
}
5828
-
5829
5837
if ( before )
5830
5838
menuBar ()->insertMenu ( before, mDatabaseMenu );
5831
5839
else
5832
- menuBar ()->addMenu ( mDatabaseMenu );
5840
+ // fallback insert
5841
+ menuBar ()->insertMenu ( firstRightStandardMenu ()->menuAction (), mDatabaseMenu );
5833
5842
}
5834
5843
5835
5844
void QgisApp::addPluginToRasterMenu ( QString name, QAction* action )
@@ -5853,6 +5862,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
5853
5862
{
5854
5863
if ( actions.at ( i )->menu () == mVectorMenu )
5855
5864
return ;
5865
+
5866
+ // goes before Raster menu, which is already in qgisapp.ui
5856
5867
if ( actions.at ( i )->menu () == mRasterMenu )
5857
5868
{
5858
5869
before = actions.at ( i );
@@ -5863,7 +5874,8 @@ void QgisApp::addPluginToVectorMenu( QString name, QAction* action )
5863
5874
if ( before )
5864
5875
menuBar ()->insertMenu ( before, mVectorMenu );
5865
5876
else
5866
- menuBar ()->addMenu ( mVectorMenu );
5877
+ // fallback insert
5878
+ menuBar ()->insertMenu ( firstRightStandardMenu ()->menuAction (), mVectorMenu );
5867
5879
}
5868
5880
5869
5881
void QgisApp::addPluginToWebMenu ( QString name, QAction* action )
@@ -5879,19 +5891,34 @@ void QgisApp::addPluginToWebMenu( QString name, QAction* action )
5879
5891
QList<QAction*> actions = menuBar ()->actions ();
5880
5892
for ( int i = 0 ; i < actions.count (); i++ )
5881
5893
{
5894
+ // goes after Database menu, if present
5895
+ if ( actions.at ( i )->menu () == mDatabaseMenu )
5896
+ {
5897
+ before = actions.at ( i += 1 );
5898
+ // don't break here
5899
+ }
5900
+
5882
5901
if ( actions.at ( i )->menu () == mWebMenu )
5883
5902
return ;
5884
- if ( actions.at ( i )->menu () == firstRightStandardMenu () )
5903
+ }
5904
+ for ( int i = 0 ; i < actions.count (); i++ )
5905
+ {
5906
+ // defaults to after Raster menu, which is already in qgisapp.ui
5907
+ if ( actions.at ( i )->menu () == mRasterMenu )
5885
5908
{
5886
- before = actions.at ( i );
5887
- break ;
5909
+ if ( !before )
5910
+ {
5911
+ before = actions.at ( i += 1 );
5912
+ break ;
5913
+ }
5888
5914
}
5889
5915
}
5890
5916
5891
5917
if ( before )
5892
5918
menuBar ()->insertMenu ( before, mWebMenu );
5893
5919
else
5894
- menuBar ()->addMenu ( mWebMenu );
5920
+ // fallback insert
5921
+ menuBar ()->insertMenu ( firstRightStandardMenu ()->menuAction (), mWebMenu );
5895
5922
}
5896
5923
5897
5924
void QgisApp::removePluginDatabaseMenu ( QString name, QAction* action )
0 commit comments