From e5c11eae067053598b41de5939120bc690c57cc5 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 19 Aug 2024 11:36:11 +1000 Subject: [PATCH] Disable "Apply" button when "Live update" enabled in styling dock Fixes #51894 --- src/app/qgslayerstylingwidget.cpp | 7 +++++-- src/app/qgslayerstylingwidget.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/qgslayerstylingwidget.cpp b/src/app/qgslayerstylingwidget.cpp index 13947780fe24..ed18fd191873 100644 --- a/src/app/qgslayerstylingwidget.cpp +++ b/src/app/qgslayerstylingwidget.cpp @@ -83,6 +83,7 @@ QgsLayerStylingWidget::QgsLayerStylingWidget( QgsMapCanvas *canvas, QgsMessageBa QgsSettings settings; mLiveApplyCheck->setChecked( settings.value( QStringLiteral( "UI/autoApplyStyling" ), true ).toBool() ); + mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( !mLiveApplyCheck->isChecked() ); mAutoApplyTimer = new QTimer( this ); mAutoApplyTimer->setSingleShot( true ); @@ -851,10 +852,12 @@ void QgsLayerStylingWidget::layerAboutToBeRemoved( QgsMapLayer *layer ) } } -void QgsLayerStylingWidget::liveApplyToggled( bool value ) +void QgsLayerStylingWidget::liveApplyToggled( bool liveUpdateEnabled ) { QgsSettings settings; - settings.setValue( QStringLiteral( "UI/autoApplyStyling" ), value ); + settings.setValue( QStringLiteral( "UI/autoApplyStyling" ), liveUpdateEnabled ); + + mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( !liveUpdateEnabled ); } void QgsLayerStylingWidget::pushUndoItem( const QString &name, bool triggerRepaint ) diff --git a/src/app/qgslayerstylingwidget.h b/src/app/qgslayerstylingwidget.h index 134dc86b1967..32f06ffa1f21 100644 --- a/src/app/qgslayerstylingwidget.h +++ b/src/app/qgslayerstylingwidget.h @@ -153,7 +153,7 @@ class APP_EXPORT QgsLayerStylingWidget : public QWidget, private Ui::QgsLayerSty private slots: void layerAboutToBeRemoved( QgsMapLayer *layer ); - void liveApplyToggled( bool value ); + void liveApplyToggled( bool liveUpdateEnabled ); private: void pushUndoItem( const QString &name, bool triggerRepaint = true );