summaryrefslogtreecommitdiff
path: root/src/plugins/clangformat/clangformatglobalconfigwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/clangformat/clangformatglobalconfigwidget.cpp')
-rw-r--r--src/plugins/clangformat/clangformatglobalconfigwidget.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp
index 24faf9031d..af8a0846b1 100644
--- a/src/plugins/clangformat/clangformatglobalconfigwidget.cpp
+++ b/src/plugins/clangformat/clangformatglobalconfigwidget.cpp
@@ -39,6 +39,7 @@ ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
m_overrideDefault = new QCheckBox(Tr::tr("Override .clang-format file"));
m_useGlobalSettings = new QCheckBox(Tr::tr("Use global settings"));
m_useGlobalSettings->hide();
+ m_overrideDefaultFile = ClangFormatSettings::instance().overrideDefaultFile();
using namespace Layouting;
@@ -190,10 +191,12 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox()
setTemporarilyReadOnly();
connect(m_overrideDefault, &QCheckBox::toggled, this, [this, setTemporarilyReadOnly](bool checked) {
- if (m_project)
+ if (m_project) {
m_project->setNamedSettings(Constants::OVERRIDE_FILE_ID, checked);
- else
+ } else {
+ ClangFormatSettings::instance().setOverrideDefaultFile(checked);
setTemporarilyReadOnly();
+ }
});
connect(m_codeStyle,
@@ -212,12 +215,14 @@ void ClangFormatGlobalConfigWidget::apply()
settings.setMode(
static_cast<ClangFormatSettings::Mode>(m_indentingOrFormatting->currentIndex()));
settings.setOverrideDefaultFile(m_overrideDefault->isChecked());
+ m_overrideDefaultFile = m_overrideDefault->isChecked();
}
settings.write();
}
void ClangFormatGlobalConfigWidget::finish()
{
+ ClangFormatSettings::instance().setOverrideDefaultFile(m_overrideDefaultFile);
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(
!ClangFormatSettings::instance().overrideDefaultFile());
}