Skip to content

Commit

Permalink
use QgsVectorDataProvider::getUniqueValues() in unique value dialog a…
Browse files Browse the repository at this point in the history
…gain (was lost in r8440)

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8588 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 4, 2008
1 parent 118f57e commit 0c272e2
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/app/qgsuniquevaluedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,29 +292,19 @@ void QgsUniqueValueDialog::changeClassificationAttribute()
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>(mVectorLayer->getDataProvider());
if (provider)
{
QString value;
QgsAttributeList attlist;

int nr = provider->indexFromFieldName(attributeName);
if(nr == -1)
{
return;
}
attlist.append(nr);

provider->select(attlist, QgsRect(), false);
QgsFeature feat;
QStringList values;
provider->getUniqueValues(nr, values);

//go through all the features and insert their value into the map and into mClassListWidget
while(provider->getNextFeature(feat))
for(int i=0; i<values.size(); i++)
{
const QgsAttributeMap& attrs = feat.attributeMap();
value = attrs[nr].toString();

if( mValues.contains(value) )
continue;

addClass(value);
if( !mValues.contains(values[i]) )
addClass(values[i]);
}
}
}
Expand Down

0 comments on commit 0c272e2

Please sign in to comment.