Skip to content

Commit

Permalink
Browser fields sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jul 8, 2020
1 parent 0981644 commit 462ce2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/qgsdataitem.cpp
Expand Up @@ -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 );
}
}
}
Expand Down

0 comments on commit 462ce2f

Please sign in to comment.