Skip to content

Commit 91f32bf

Browse files
committed
Fix sorting by other than first sort role
1 parent f1770c7 commit 91f32bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/gui/attributetable/qgsattributetablemodel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,13 +616,13 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
616616
&& role != Qt::DisplayRole
617617
&& role != Qt::ToolTipRole
618618
&& role != Qt::EditRole
619-
&& role != SortRole
620619
&& role != FeatureIdRole
621620
&& role != FieldIndexRole
622621
&& role != Qt::BackgroundColorRole
623622
&& role != Qt::TextColorRole
624623
&& role != Qt::DecorationRole
625624
&& role != Qt::FontRole
625+
&& role < SortRole
626626
)
627627
)
628628
return QVariant();
@@ -897,7 +897,8 @@ void QgsAttributeTableModel::prefetchSortData( const QString &expressionString,
897897
if ( cache.sortFieldIndex == -1 )
898898
{
899899
mExpressionContext.setFeature( f );
900-
cache.sortCache.insert( f.id(), cache.sortCacheExpression.evaluate( &mExpressionContext ) );
900+
const QVariant cacheValue = cache.sortCacheExpression.evaluate( &mExpressionContext );
901+
cache.sortCache.insert( f.id(), cacheValue );
901902
}
902903
else
903904
{

0 commit comments

Comments
 (0)