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

(cherry-picked from 381eef)
  • Loading branch information
nyalldawson committed May 23, 2017
1 parent 8992eea commit 261eba0
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
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTa
}
}

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

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

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

0 comments on commit 261eba0

Please sign in to comment.