Skip to content

Commit

Permalink
Enable restoring of actions embedded within drop-down toolbuttons on …
Browse files Browse the repository at this point in the history
…Toolbar
  • Loading branch information
DelazJ committed Aug 17, 2019
1 parent 48cfc3b commit ad1af97
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/app/qgscustomization.cpp
Expand Up @@ -763,12 +763,32 @@ void QgsCustomization::updateMainWindow( QMenu *toolBarMenu )
for ( QAction *action : constActions )
{
if ( action->objectName().isEmpty() )
{
continue;
}

visible = mSettings->value( action->objectName(), true ).toBool();
if ( !visible )
{
tb->removeAction( action );
continue;
}

if ( visible && action->metaObject()->className() == QStringLiteral( "QWidgetAction" ) )
{
mSettings->beginGroup( action->objectName() );
QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>( action );
QWidget *widget = widgetAction->defaultWidget();
QList<QAction *> childActions = widget->actions();
for ( QAction *wAction : childActions )
{
if ( wAction->objectName().isEmpty() )
continue;

visible = mSettings->value( wAction->objectName(), true ).toBool();
if ( !visible )
widget->removeAction( wAction );
}
mSettings->endGroup();
}
}
mSettings->endGroup();
}
Expand Down

0 comments on commit ad1af97

Please sign in to comment.