Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[processing] Use matrix editor panel value if open #60551

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/gui/processing/qgsprocessingmatrixparameterdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,15 @@ QgsProcessingMatrixParameterPanel::QgsProcessingMatrixParameterPanel( QWidget *p
connect( mToolButton, &QToolButton::clicked, this, &QgsProcessingMatrixParameterPanel::showDialog );
}

QVariantList QgsProcessingMatrixParameterPanel::value() const
{
// if editing widget is still open, use the value currently shown in that widget
if ( mPanelWidget )
return mPanelWidget->table();

return mTable;
}

void QgsProcessingMatrixParameterPanel::setValue( const QVariantList &value )
{
mTable = value;
Expand All @@ -190,14 +199,14 @@ void QgsProcessingMatrixParameterPanel::showDialog()
{
if ( QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( this ) )
{
QgsProcessingMatrixParameterPanelWidget *widget = new QgsProcessingMatrixParameterPanelWidget( this, mParam, mTable );
mPanelWidget = new QgsProcessingMatrixParameterPanelWidget( this, mParam, mTable );

widget->setPanelTitle( mParam->description() );
mPanelWidget->setPanelTitle( mParam->description() );

panel->openPanel( widget );
panel->openPanel( mPanelWidget );

connect( widget, &QgsPanelWidget::widgetChanged, this, [=] {
setValue( widget->table() );
connect( mPanelWidget, &QgsPanelWidget::widgetChanged, this, [=] {
setValue( mPanelWidget->table() );
} );
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/gui/processing/qgsprocessingmatrixparameterdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class GUI_EXPORT QgsProcessingMatrixParameterPanel : public QWidget
public:
QgsProcessingMatrixParameterPanel( QWidget *parent = nullptr, const QgsProcessingParameterMatrix *param = nullptr );

QVariantList value() const { return mTable; }
QVariantList value() const;

void setValue( const QVariantList &value );

Expand All @@ -102,6 +102,7 @@ class GUI_EXPORT QgsProcessingMatrixParameterPanel : public QWidget
QToolButton *mToolButton = nullptr;

QVariantList mTable;
QPointer< QgsProcessingMatrixParameterPanelWidget > mPanelWidget;

friend class TestProcessingGui;
};
Expand Down
Loading