Skip to content

Commit 32e2849

Browse files
committedJan 7, 2016
Allow removing multiple ramps at once in style manager
...previously multiple ramps could be selected, but only the first would be removed
1 parent f6ed453 commit 32e2849

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed
 

‎src/gui/symbology-ng/qgsstylev2managerdialog.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -732,16 +732,20 @@ bool QgsStyleV2ManagerDialog::removeSymbol()
732732

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

744-
mStyle->removeColorRamp( rampName );
742+
Q_FOREACH ( const QModelIndex& index, indexes )
743+
{
744+
QString rampName = index.data().toString();
745+
// delete from style and update list
746+
if ( !rampName.isEmpty() )
747+
mStyle->removeColorRamp( rampName );
748+
}
745749
mModified = true;
746750
return true;
747751
}

0 commit comments

Comments
 (0)
Please sign in to comment.