Skip to content

Commit

Permalink
Microoptimise opening attribute table - don't call sort on model when…
Browse files Browse the repository at this point in the history
… no sort order set
  • Loading branch information
nyalldawson committed May 23, 2017
1 parent ebee101 commit 381eef0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/gui/attributetable/qgsattributetablefiltermodel.cpp
Expand Up @@ -215,7 +215,8 @@ void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTa
}
}

sort( config.sortExpression(), config.sortOrder() );
if ( !config.sortExpression().isEmpty() )
sort( config.sortExpression(), config.sortOrder() );
}

void QgsAttributeTableFilterModel::sort( const QString &expression, Qt::SortOrder order )
Expand Down
4 changes: 2 additions & 2 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -257,7 +257,7 @@ void QgsAttributeTableModel::editCommandEnded()
void QgsAttributeTableModel::attributeDeleted( int idx )
{
if ( mSortCacheAttributes.contains( idx ) )
prefetchSortData( QLatin1String( "" ) );
prefetchSortData( QString() );
}

void QgsAttributeTableModel::layerDeleted()
Expand Down Expand Up @@ -785,7 +785,7 @@ void QgsAttributeTableModel::prefetchColumnData( int column )
{
if ( column == -1 || column >= mAttributes.count() )
{
prefetchSortData( QLatin1String( "" ) );
prefetchSortData( QString() );
}
else
{
Expand Down

0 comments on commit 381eef0

Please sign in to comment.