Skip to content

Commit

Permalink
[processing] Fix annoying loss of matrix parameter table values
Browse files Browse the repository at this point in the history
if back button is pressed in table panel instead of "Ok"

The back button was treated as "cancel", but now the "cancel" only
happens if the user explicitly hits the Cancel button.
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Dec 7, 2022
1 parent 6a07f3c commit e421335
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gui/processing/qgsprocessingmatrixparameterdialog.cpp
Expand Up @@ -43,14 +43,16 @@ QgsProcessingMatrixParameterPanelWidget::QgsProcessingMatrixParameterPanelWidget
mButtonRemoveAll = new QPushButton( tr( "Remove All" ) );
mButtonBox->addButton( mButtonRemoveAll, QDialogButtonBox::ActionRole );

connect( mButtonBox->button( QDialogButtonBox::Ok ), &QPushButton::clicked, this, [ = ]
connect( mButtonBox->button( QDialogButtonBox::Ok ), &QPushButton::clicked, this, &QgsPanelWidget::acceptPanel );
connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QPushButton::clicked, this, [ = ]
{
emit widgetChanged();
mWasCanceled = true;
acceptPanel();
} );
connect( mButtonBox->button( QDialogButtonBox::Cancel ), &QPushButton::clicked, this, [ = ]
connect( this, &QgsPanelWidget::panelAccepted, this, [ = ]()
{
acceptPanel();
if ( !mWasCanceled )
emit widgetChanged();
} );

connect( mButtonAdd, &QPushButton::clicked, this, &QgsProcessingMatrixParameterPanelWidget::addRow );
Expand Down
1 change: 1 addition & 0 deletions src/gui/processing/qgsprocessingmatrixparameterdialog.h
Expand Up @@ -64,6 +64,7 @@ class GUI_EXPORT QgsProcessingMatrixParameterPanelWidget : public QgsPanelWidget
QPushButton *mButtonRemoveAll = nullptr;
const QgsProcessingParameterMatrix *mParam = nullptr;
QStandardItemModel *mModel = nullptr;
bool mWasCanceled = false;

void populateTable( const QVariantList &contents );

Expand Down

0 comments on commit e421335

Please sign in to comment.