Skip to content
Permalink
Browse files

Avoid adding duplicate scales to the scale list.

  • Loading branch information
SebDieBln committed Dec 8, 2015
1 parent 9aff9c5 commit 33ea2a0416bd7e96e26cd65cd26bba98d108c609
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/app/qgsoptions.cpp
@@ -2152,7 +2152,11 @@ void QgsOptions::on_mButtonExportColors_clicked()

QListWidgetItem* QgsOptions::addScaleToScaleList( const QString &newScale )
{
QListWidgetItem* newItem = new QListWidgetItem();
QListWidgetItem* newItem;
newItem = mListGlobalScales->findItems( newScale, Qt::MatchExactly ).value( 0 );
if ( newItem )
return newItem;

int newDenominator = newScale.split( ":" ).value( 1 ).toInt();
int i;
for ( i = 0; i < mListGlobalScales->count(); i++ )
@@ -2161,7 +2165,7 @@ QListWidgetItem* QgsOptions::addScaleToScaleList( const QString &newScale )
if ( newDenominator > denominator )
break;
}
newItem->setText( newScale );
newItem = new QListWidgetItem( newScale );
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
mListGlobalScales->insertItem( i, newItem );
return newItem;

0 comments on commit 33ea2a0

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