Skip to content

Commit

Permalink
Disable "Apply" button when "Live update" enabled in styling dock
Browse files Browse the repository at this point in the history
Fixes #51894
  • Loading branch information
nyalldawson committed Aug 19, 2024
1 parent 217210a commit e5c11ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/app/qgslayerstylingwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgslayerstylingwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit e5c11ea

Please sign in to comment.