File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -519,11 +519,21 @@ void QgsColorButtonV2::addRecentColor( const QColor& color )
519
519
520
520
QSettings settings;
521
521
QList< QVariant > recentColorVariants = settings.value ( QString ( " /colors/recent" ) ).toList ();
522
- QVariant colorVariant = QVariant ( opaqueColor );
523
- recentColorVariants.removeAll ( colorVariant );
524
522
523
+ // remove colors by name
524
+ for ( int colorIdx = recentColorVariants.length () - 1 ; colorIdx >= 0 ; --colorIdx )
525
+ {
526
+ if (( recentColorVariants.at ( colorIdx ).value <QColor>() ).name () == opaqueColor.name () )
527
+ {
528
+ recentColorVariants.removeAt ( colorIdx );
529
+ }
530
+ }
531
+
532
+ // add color
533
+ QVariant colorVariant = QVariant ( opaqueColor );
525
534
recentColorVariants.prepend ( colorVariant );
526
535
536
+ // trim to 20 colors
527
537
while ( recentColorVariants.count () > 20 )
528
538
{
529
539
recentColorVariants.pop_back ();
You can’t perform that action at this time.
0 commit comments