Skip to content
Permalink
Browse files

Add 'Copy to default' action as a dedicated button when browsing non-…

…default style
  • Loading branch information
nyalldawson committed Jan 16, 2019
1 parent 878cec9 commit 1a45c8c0391ecffb86a29f03854134cd3d050dbb
Showing with 21 additions and 1 deletion.
  1. +10 −1 src/gui/symbology/qgsstylemanagerdialog.cpp
  2. +11 −0 src/ui/qgsstylemanagerdialogbase.ui
@@ -205,9 +205,14 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,
}
if ( mStyle != QgsStyle::defaultStyle() )
{
mActionCopyToDefault = new QAction( tr( "Copy Selection to Default Style" ), this );
mActionCopyToDefault = new QAction( tr( "Copy Selection to Default Style" ), this );
shareMenu->addAction( mActionCopyToDefault );
connect( mActionCopyToDefault, &QAction::triggered, this, &QgsStyleManagerDialog::copyItemsToDefault );
connect( mCopyToDefaultButton, &QPushButton::clicked, this, &QgsStyleManagerDialog::copyItemsToDefault );
}
else
{
mCopyToDefaultButton->hide();
}

shareMenu->addSeparator();
@@ -386,6 +391,9 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle *style, QWidget *parent,
// note -- we have to save state here and not in destructor, as new symbol list widgets are created before the previous ones are destroyed
QgsSettings().setValue( QStringLiteral( "Windows/StyleV2Manager/treeState" ), mSymbolTreeView->header()->saveState(), QgsSettings::Gui );
} );

// set initial disabled state for actions requiring a selection
selectedSymbolsChanged( QItemSelection(), QItemSelection() );
}

void QgsStyleManagerDialog::onFinished()
@@ -1596,6 +1604,7 @@ void QgsStyleManagerDialog::selectedSymbolsChanged( const QItemSelection &select
actnExportAsSVG->setDisabled( nothingSelected );
if ( mActionCopyToDefault )
mActionCopyToDefault->setDisabled( nothingSelected );
mCopyToDefaultButton->setDisabled( nothingSelected );
actnEditItem->setDisabled( nothingSelected || mReadOnly );
}

@@ -189,6 +189,16 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mCopyToDefaultButton">
<property name="toolTip">
<string>Copies the selected items to the default style library</string>
</property>
<property name="text">
<string>Copy to Default Style…</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@@ -625,6 +635,7 @@
<tabstop>btnAddItem</tabstop>
<tabstop>btnRemoveItem</tabstop>
<tabstop>btnEditItem</tabstop>
<tabstop>mCopyToDefaultButton</tabstop>
<tabstop>mButtonIconView</tabstop>
<tabstop>mButtonListView</tabstop>
<tabstop>searchBox</tabstop>

0 comments on commit 1a45c8c

Please sign in to comment.
You can’t perform that action at this time.