Skip to content
Permalink
Browse files

Browser fields sorting

  • Loading branch information
elpaso committed Jul 8, 2020
1 parent 0981644 commit 462ce2fe261b3999ab0a99a10382ed3844e289cb
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/core/qgsdataitem.cpp
@@ -142,10 +142,13 @@ QVector<QgsDataItem *> QgsFieldsItem::createChildren()
std::unique_ptr<QgsAbstractDatabaseProviderConnection> conn { static_cast<QgsAbstractDatabaseProviderConnection *>( md->createConnection( mConnectionUri, {} ) ) };
if ( conn )
{
int i = 0;
const QgsFields constFields { conn->fields( mSchema, mTableName ) };
for ( const auto &f : constFields )
{
children.push_back( new QgsFieldItem( this, f ) );
QgsFieldItem *fieldItem { new QgsFieldItem( this, f ) };
fieldItem->setSortKey( i++ );
children.push_back( fieldItem );
}
}
}

0 comments on commit 462ce2f

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