[QGIS Commit] r8525 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon May 26 12:11:41 EDT 2008


Author: jef
Date: 2008-05-26 12:11:40 -0400 (Mon, 26 May 2008)
New Revision: 8525

Modified:
   trunk/qgis/src/app/qgsuniquevaluedialog.cpp
Log:
update list widget colors on reset/randomize colors

Modified: trunk/qgis/src/app/qgsuniquevaluedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsuniquevaluedialog.cpp	2008-05-26 15:49:58 UTC (rev 8524)
+++ trunk/qgis/src/app/qgsuniquevaluedialog.cpp	2008-05-26 16:11:40 UTC (rev 8525)
@@ -215,31 +215,28 @@
   mClassListWidget->addItem(item);
 
   setSymbolColor(symbol, randomColor() );
+  updateEntryIcon(symbol, item);
 }
 
 void QgsUniqueValueDialog::randomizeColors()
 {
   QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
-  if(selection.size()>0) {
-    for(int i=0; i<selection.size(); i++)
-    {
-      QListWidgetItem *item=selection[i];
-      if(!item)
-        continue;
+  if(selection.size()==0)
+    selection = mClassListWidget->findItems("", Qt::MatchContains);
 
-      if( !mValues.contains( item->text() ) )
-        continue;
+  for(int i=0; i<selection.size(); i++)
+  {
+    QListWidgetItem *item=selection[i];
+    if(!item)
+      continue;
 
-      setSymbolColor( mValues[ item->text() ], randomColor() );
-    }
+    if( !mValues.contains( item->text() ) )
+      continue;
+
+    QgsSymbol *symbol = mValues[ item->text() ];
+    setSymbolColor( symbol, randomColor() );
+    updateEntryIcon(symbol, item);
   }
-  else
-  {
-    for(QMap<QString, QgsSymbol *>::iterator it = mValues.begin(); it!=mValues.end(); it++)
-    {
-      setSymbolColor( it.value(), randomColor() );
-    }
-  }
 
   selectionChanged();
 }
@@ -250,24 +247,22 @@
   white.setRgb(255.0, 255.0, 255.0);
 
   QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
-  if(selection.size()>0) {
-    for(int i=0; i<selection.size(); i++)
-    {
-      QListWidgetItem *item=selection[i];
-      if( !item ) continue;
+  if(selection.size()==0)
+    selection = mClassListWidget->findItems("", Qt::MatchContains);
 
-      if( !mValues.contains( item->text() ) )continue;
+  for(int i=0; i<selection.size(); i++)
+  {
+    QListWidgetItem *item=selection[i];
+    if( !item )
+      continue;
 
-      setSymbolColor( mValues[ item->text() ], white);
-    }
+    if( !mValues.contains( item->text() ) )
+      continue;
+
+    QgsSymbol *symbol = mValues[ item->text() ];
+    setSymbolColor( symbol, white);
+    updateEntryIcon(symbol, item);
   }
-  else
-  {
-    for(QMap<QString, QgsSymbol *>::iterator it = mValues.begin(); it!=mValues.end(); it++)
-    {
-      setSymbolColor( it.value(), white);
-    }
-  }
 
   selectionChanged();
 }



More information about the QGIS-commit mailing list