Skip to content
Permalink
Browse files

Fix merge attribute dialog picks wrong field values when fields are h…

…idden
  • Loading branch information
nyalldawson committed Apr 3, 2018
1 parent adf5d79 commit 001796dd09742ddf9872c19c8cd94990b3244bcc
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/app/qgsmergeattributesdialog.cpp
@@ -285,6 +285,8 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col )
return;
}

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

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

//insert string into table widget

0 comments on commit 001796d

Please sign in to comment.
You can’t perform that action at this time.