From 9ef7d456409a802fdca29f6fb9a8d3515d9a8e16 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 27 Apr 2024 12:21:23 +0800 Subject: [PATCH] Auto set "remove superfluous empty lines" spinbox enable state with the checkbox --- RedPandaIDE/settingsdialog/formattergeneralwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp b/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp index 3f79d4ee..2ffc63e1 100644 --- a/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/formattergeneralwidget.cpp @@ -31,6 +31,9 @@ FormatterGeneralWidget::FormatterGeneralWidget(const QString& name, const QStrin connect(this, &SettingsWidget::settingsChanged, this, &FormatterGeneralWidget::updateDemo); + connect(ui->chkSqueezeEmptyLines, &QCheckBox::toggled, + ui->spinSqueezeEmptyLines, &QSpinBox::setEnabled); + ui->cbMinConditionalIndent->addItem(tr("No minimal indent"),0); ui->cbMinConditionalIndent->addItem(tr("Indent at least one additional indent"),1); ui->cbMinConditionalIndent->addItem(tr("Indent at least two additional indents"),2); @@ -99,6 +102,7 @@ void FormatterGeneralWidget::doLoad() ui->chkDeleteEmptyLines->setChecked(format.deleteEmptyLines()); ui->chkFillEmptyLines->setChecked(format.fillEmptyLines()); ui->chkSqueezeEmptyLines->setChecked(format.squeezeLines()); + ui->spinSqueezeEmptyLines->setEnabled(format.squeezeLines()); ui->spinSqueezeEmptyLines->setValue(format.squeezeLinesNumber()); ui->chkSqueezeWhitespace->setChecked(format.squeezeWhitespace()); switch(format.alignPointerStyle()) {