Skip to content
Permalink
Browse files

update list widget colors on reset/randomize colors

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8525 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed May 26, 2008
1 parent aee2f8f commit f2c4b2a744bbcf0e76fd81701d26d9fe7eea7ac3
Showing with 27 additions and 32 deletions.
  1. +27 −32 src/app/qgsuniquevaluedialog.cpp
@@ -215,30 +215,27 @@ void QgsUniqueValueDialog::addClass(QString value)
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( !mValues.contains( item->text() ) )
continue;
if(selection.size()==0)
selection = mClassListWidget->findItems("", Qt::MatchContains);

setSymbolColor( mValues[ item->text() ], randomColor() );
}
}
else
for(int i=0; i<selection.size(); i++)
{
for(QMap<QString, QgsSymbol *>::iterator it = mValues.begin(); it!=mValues.end(); it++)
{
setSymbolColor( it.value(), randomColor() );
}
QListWidgetItem *item=selection[i];
if(!item)
continue;

if( !mValues.contains( item->text() ) )
continue;

QgsSymbol *symbol = mValues[ item->text() ];
setSymbolColor( symbol, randomColor() );
updateEntryIcon(symbol, item);
}

selectionChanged();
@@ -250,23 +247,21 @@ void QgsUniqueValueDialog::resetColors()
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( !mValues.contains( item->text() ) )continue;
if(selection.size()==0)
selection = mClassListWidget->findItems("", Qt::MatchContains);

setSymbolColor( mValues[ item->text() ], white);
}
}
else
for(int i=0; i<selection.size(); i++)
{
for(QMap<QString, QgsSymbol *>::iterator it = mValues.begin(); it!=mValues.end(); it++)
{
setSymbolColor( it.value(), white);
}
QListWidgetItem *item=selection[i];
if( !item )
continue;

if( !mValues.contains( item->text() ) )
continue;

QgsSymbol *symbol = mValues[ item->text() ];
setSymbolColor( symbol, white);
updateEntryIcon(symbol, item);
}

selectionChanged();

0 comments on commit f2c4b2a

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