[QGIS Commit] r12511 - trunk/qgis/src/gui/symbology-ng

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Dec 19 05:41:57 EST 2009


Author: wonder
Date: 2009-12-19 05:41:57 -0500 (Sat, 19 Dec 2009)
New Revision: 12511

Modified:
   trunk/qgis/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.cpp
Log:
Select a valid variant when there's no variant with the same number of colors in new scheme. Fixes #2254


Modified: trunk/qgis/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.cpp
===================================================================
--- trunk/qgis/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.cpp	2009-12-19 10:29:23 UTC (rev 12510)
+++ trunk/qgis/src/gui/symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.cpp	2009-12-19 10:41:57 UTC (rev 12511)
@@ -59,7 +59,13 @@
   }
 
   // try to set the original variant again (if exists)
-  cboColors->setCurrentIndex( cboColors->findText( oldVariant ) );
+  int idx = cboColors->findText( oldVariant );
+  if ( idx == -1 ) // not found?
+  {
+    // use the last item
+    idx = cboColors->count() - 1;
+  }
+  cboColors->setCurrentIndex( idx );
 }
 
 void QgsVectorColorBrewerColorRampV2Dialog::updatePreview()



More information about the QGIS-commit mailing list