From ac4132e90b5400a12aa434b410c9c3b84d613ce2 Mon Sep 17 00:00:00 2001 From: Blottiere Paul Date: Tue, 29 Sep 2020 16:37:03 +0200 Subject: [PATCH] Keep role in sync Fixes #37659 --- src/app/qgsmergeattributesdialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index c876f5a66e39..4af71052eeda 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -324,6 +324,7 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col ) const int fieldIdx = mTableWidget->horizontalHeaderItem( col )->data( FieldIndex ).toInt(); //evaluate behavior (feature value or min / max / mean ) + QTableWidgetItem *item = mTableWidget->item( mTableWidget->rowCount() - 1, col ); const QString mergeBehaviorString = comboBox->currentData().toString(); QVariant mergeResult; // result to show in the merge result field if ( mergeBehaviorString == QStringLiteral( "concat" ) ) @@ -336,7 +337,7 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col ) } else if ( mergeBehaviorString == QLatin1String( "manual" ) ) { - return; //nothing to do + mergeResult = item->data( Qt::DisplayRole ); } else if ( mergeBehaviorString.startsWith( 'f' ) ) { @@ -353,7 +354,6 @@ void QgsMergeAttributesDialog::refreshMergedValue( int col ) //insert string into table widget mUpdating = true; // prevent combobox changing to "manual" value - QTableWidgetItem *item = mTableWidget->item( mTableWidget->rowCount() - 1, col ); // Result formatting QString stringVal; @@ -559,6 +559,7 @@ void QgsMergeAttributesDialog::tableWidgetCellChanged( int row, int column ) currentComboBox->blockSignals( true ); currentComboBox->setCurrentIndex( currentComboBox->findData( QStringLiteral( "manual" ) ) ); currentComboBox->blockSignals( false ); + refreshMergedValue( column ); } }