Skip to content

Commit 0c272e2

Browse files
author
jef
committedJun 4, 2008
use QgsVectorDataProvider::getUniqueValues() in unique value dialog again (was lost in r8440)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8588 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed
 

‎src/app/qgsuniquevaluedialog.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,29 +292,19 @@ void QgsUniqueValueDialog::changeClassificationAttribute()
292292
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>(mVectorLayer->getDataProvider());
293293
if (provider)
294294
{
295-
QString value;
296-
QgsAttributeList attlist;
297-
298295
int nr = provider->indexFromFieldName(attributeName);
299296
if(nr == -1)
300297
{
301298
return;
302299
}
303-
attlist.append(nr);
304300

305-
provider->select(attlist, QgsRect(), false);
306-
QgsFeature feat;
301+
QStringList values;
302+
provider->getUniqueValues(nr, values);
307303

308-
//go through all the features and insert their value into the map and into mClassListWidget
309-
while(provider->getNextFeature(feat))
304+
for(int i=0; i<values.size(); i++)
310305
{
311-
const QgsAttributeMap& attrs = feat.attributeMap();
312-
value = attrs[nr].toString();
313-
314-
if( mValues.contains(value) )
315-
continue;
316-
317-
addClass(value);
306+
if( !mValues.contains(values[i]) )
307+
addClass(values[i]);
318308
}
319309
}
320310
}

0 commit comments

Comments
 (0)
Please sign in to comment.