Skip to content

Commit 2fd51c0

Browse files
committed
Fix merge attribute dialog picks wrong field values when fields are hidden
(cherry-picked from 001796d)
1 parent 8d71ed3 commit 2fd51c0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/app/qgsmergeattributesdialog.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
285285
return;
286286
}
287287

288+
int fieldIdx = mTableWidget->horizontalHeaderItem( col )->data( FieldIndex ).toInt();
289+
288290
//evaluate behavior (feature value or min / max / mean )
289291
QString mergeBehaviorString = comboBox->currentData().toString();
290292
QVariant mergeResult; // result to show in the merge result field
@@ -304,13 +306,13 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
304306
{
305307
//an existing feature value
306308
QgsFeatureId featureId = STRING_TO_FID( mergeBehaviorString.mid( 1 ) );
307-
mergeResult = featureAttribute( featureId, col );
309+
mergeResult = featureAttribute( featureId, fieldIdx );
308310
}
309311
else
310312
{
311313
//numerical statistic
312314
QgsStatisticalSummary::Statistic stat = ( QgsStatisticalSummary::Statistic )( comboBox->currentData().toInt() );
313-
mergeResult = calcStatistic( col, stat );
315+
mergeResult = calcStatistic( fieldIdx, stat );
314316
}
315317

316318
//insert string into table widget

0 commit comments

Comments
 (0)