Skip to content

Commit

Permalink
Allow removing multiple ramps at once in style manager
Browse files Browse the repository at this point in the history
...previously multiple ramps could be selected, but only the
first would be removed
  • Loading branch information
nyalldawson committed Jan 7, 2016
1 parent f6ed453 commit 32e2849
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/gui/symbology-ng/qgsstylev2managerdialog.cpp
Expand Up @@ -732,16 +732,20 @@ bool QgsStyleV2ManagerDialog::removeSymbol()

bool QgsStyleV2ManagerDialog::removeColorRamp()
{
QString rampName = currentItemName();
if ( rampName.isEmpty() )
return false;
QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
if ( QMessageBox::Yes != QMessageBox::question( this, tr( "Confirm removal" ),
QString( tr( "Do you really want to remove the colorramp '%1'?" ) ).arg( rampName ),
QString( tr( "Do you really want to remove %n ramps(s)?", nullptr, indexes.count() ) ),
QMessageBox::Yes,
QMessageBox::No ) )
return false;

mStyle->removeColorRamp( rampName );
Q_FOREACH ( const QModelIndex& index, indexes )
{
QString rampName = index.data().toString();
// delete from style and update list
if ( !rampName.isEmpty() )
mStyle->removeColorRamp( rampName );
}
mModified = true;
return true;
}
Expand Down

0 comments on commit 32e2849

Please sign in to comment.