Skip to content

Commit

Permalink
Fix sorting by other than first sort role
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed May 17, 2018
1 parent f1770c7 commit 91f32bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -616,13 +616,13 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
&& role != Qt::DisplayRole
&& role != Qt::ToolTipRole
&& role != Qt::EditRole
&& role != SortRole
&& role != FeatureIdRole
&& role != FieldIndexRole
&& role != Qt::BackgroundColorRole
&& role != Qt::TextColorRole
&& role != Qt::DecorationRole
&& role != Qt::FontRole
&& role < SortRole
)
)
return QVariant();
Expand Down Expand Up @@ -897,7 +897,8 @@ void QgsAttributeTableModel::prefetchSortData( const QString &expressionString,
if ( cache.sortFieldIndex == -1 )
{
mExpressionContext.setFeature( f );
cache.sortCache.insert( f.id(), cache.sortCacheExpression.evaluate( &mExpressionContext ) );
const QVariant cacheValue = cache.sortCacheExpression.evaluate( &mExpressionContext );
cache.sortCache.insert( f.id(), cacheValue );
}
else
{
Expand Down

0 comments on commit 91f32bf

Please sign in to comment.