Skip to content

Commit

Permalink
fix customization for dock and toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
speillet authored and nyalldawson committed Sep 24, 2021
1 parent b40c53c commit 968964a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -1616,7 +1616,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh

// do main window customization - after window state has been restored, before the window is shown
startProfile( tr( "Update customization on main window" ) );
QgsCustomization::instance()->updateMainWindow( mToolbarMenu );
QgsCustomization::instance()->updateMainWindow( mToolbarMenu, mPanelMenu );
endProfile();

mSplash->showMessage( tr( "Populate saved styles" ), Qt::AlignHCenter | Qt::AlignBottom, splashTextColor );
Expand Down
5 changes: 4 additions & 1 deletion src/app/qgscustomization.cpp
Expand Up @@ -774,7 +774,7 @@ QgsCustomization::QgsCustomization()
mEnabled = settings.value( QStringLiteral( "UI/Customization/enabled" ), "false" ).toString() == QLatin1String( "true" );
}

void QgsCustomization::updateMainWindow( QMenu *toolBarMenu )
void QgsCustomization::updateMainWindow( QMenu *toolBarMenu, QMenu *panelMenu )
{
// collect tree items even if the customization is disabled
createTreeItemMenus();
Expand Down Expand Up @@ -823,6 +823,7 @@ void QgsCustomization::updateMainWindow( QMenu *toolBarMenu )
if ( !visible )
{
mw->removeToolBar( tb );
tb->setParent( NULL );
// remove also from menu, because toolbars removed here, switched on later from menu don't work correctly
toolBarMenu->removeAction( tb->toggleViewAction() );
}
Expand Down Expand Up @@ -880,6 +881,8 @@ void QgsCustomization::updateMainWindow( QMenu *toolBarMenu )
if ( !visible )
{
mw->removeDockWidget( dw );
dw->setParent( NULL );
panelMenu->removeAction( dw->toggleViewAction() );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgscustomization.h
Expand Up @@ -132,7 +132,7 @@ class APP_EXPORT QgsCustomization : public QObject
static void removeFromLayout( QLayout *layout, QWidget *widget );

void updateBrowserWidget( QgsBrowserDockWidget *model );
void updateMainWindow( QMenu *toolBarMenu );
void updateMainWindow( QMenu *toolBarMenu, QMenu *panelMenu );

// make sure to enable/disable before creating QgisApp in order to get it customized (or not)
void setEnabled( bool enabled ) { mEnabled = enabled; }
Expand Down

0 comments on commit 968964a

Please sign in to comment.