Skip to content
Permalink
Browse files

QgsVectorLayer::uniqueValues() also returns uncommitted values

  • Loading branch information
m-kuhn committed Aug 27, 2014
1 parent 482fa44 commit 1bdef80ef4051ae1e8e8acb805c1002a08b70e0e
Showing with 23 additions and 1 deletion.
  1. +23 −1 src/core/qgsvectorlayer.cpp
@@ -2819,7 +2819,29 @@ void QgsVectorLayer::uniqueValues( int index, QList<QVariant> &uniqueValues, int

if ( origin == QgsFields::OriginProvider ) //a provider field
{
return mDataProvider->uniqueValues( index, uniqueValues, limit );
mDataProvider->uniqueValues( index, uniqueValues, limit );

QSet<QString> vals;
Q_FOREACH( const QVariant& v, uniqueValues )
vals << v.toString();

QMapIterator< QgsFeatureId, QgsAttributeMap > it ( mEditBuffer->changedAttributeValues() );
while ( it.hasNext() && ( limit < 0 || uniqueValues.count() < limit ) )
{
it.next();
QVariant v = it.value().value( index );
if ( v.isValid() )
{
QString vs = v.toString();
if ( !vals.contains( vs ) )
{
vals << vs;
uniqueValues << v;
}
}
}

return;
}
else if ( origin == QgsFields::OriginJoin )
{

0 comments on commit 1bdef80

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