Skip to content

Commit

Permalink
Fix merge attribute dialog picks wrong field values when fields are h…
Browse files Browse the repository at this point in the history
…idden

(cherry-picked from 001796d)
  • Loading branch information
nyalldawson committed Apr 6, 2018
1 parent 8d71ed3 commit 2fd51c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/qgsmergeattributesdialog.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
return; return;
} }


int fieldIdx = mTableWidget->horizontalHeaderItem( col )->data( FieldIndex ).toInt();

//evaluate behavior (feature value or min / max / mean ) //evaluate behavior (feature value or min / max / mean )
QString mergeBehaviorString = comboBox->currentData().toString(); QString mergeBehaviorString = comboBox->currentData().toString();
QVariant mergeResult; // result to show in the merge result field QVariant mergeResult; // result to show in the merge result field
Expand All @@ -304,13 +306,13 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
{ {
//an existing feature value //an existing feature value
QgsFeatureId featureId = STRING_TO_FID( mergeBehaviorString.mid( 1 ) ); QgsFeatureId featureId = STRING_TO_FID( mergeBehaviorString.mid( 1 ) );
mergeResult = featureAttribute( featureId, col ); mergeResult = featureAttribute( featureId, fieldIdx );
} }
else else
{ {
//numerical statistic //numerical statistic
QgsStatisticalSummary::Statistic stat = ( QgsStatisticalSummary::Statistic )( comboBox->currentData().toInt() ); QgsStatisticalSummary::Statistic stat = ( QgsStatisticalSummary::Statistic )( comboBox->currentData().toInt() );
mergeResult = calcStatistic( col, stat ); mergeResult = calcStatistic( fieldIdx, stat );
} }


//insert string into table widget //insert string into table widget
Expand Down

0 comments on commit 2fd51c0

Please sign in to comment.