diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-03-05 13:12:44 +0100 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2019-03-05 14:48:59 +0000 |
commit | bf972bcb01d57a7143eba4397e69e1db3a8d693b (patch) | |
tree | 1e65a329a86269d04a702e721c0e3e7179430240 /src/plugins/clangformat/clangformatsettings.cpp | |
parent | 2484a5e209a95bf5d369372ed85a80ca7bc90f03 (diff) |
ClangFormat: Change the logic how configuration is picked
Let's use by default the configuration that clang-format picks itself
for the source file. The Qt Creator configuration will now only
override the default one with global or project settings and can be
turned off with the checkbox.
This behavior is clearer than always picking some configuration
which Qt Creator prefers best.
Change-Id: If5ed3d67eb6b4b47a6d0fd5259f7efbb608914d1
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Diffstat (limited to 'src/plugins/clangformat/clangformatsettings.cpp')
-rw-r--r-- | src/plugins/clangformat/clangformatsettings.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/clangformat/clangformatsettings.cpp b/src/plugins/clangformat/clangformatsettings.cpp index 8be2b3cefe..8f70130ae3 100644 --- a/src/plugins/clangformat/clangformatsettings.cpp +++ b/src/plugins/clangformat/clangformatsettings.cpp @@ -46,6 +46,8 @@ ClangFormatSettings::ClangFormatSettings() .toBool(); m_formatOnSave = settings->value(QLatin1String(Constants::FORMAT_CODE_ON_SAVE_ID), false) .toBool(); + m_overrideDefaultFile = settings->value(QLatin1String(Constants::OVERRIDE_FILE_ID), false) + .toBool(); settings->endGroup(); } @@ -57,6 +59,7 @@ void ClangFormatSettings::write() const m_formatCodeInsteadOfIndent); settings->setValue(QLatin1String(Constants::FORMAT_WHILE_TYPING_ID), m_formatWhileTyping); settings->setValue(QLatin1String(Constants::FORMAT_CODE_ON_SAVE_ID), m_formatOnSave); + settings->setValue(QLatin1String(Constants::OVERRIDE_FILE_ID), m_overrideDefaultFile); settings->endGroup(); } @@ -90,4 +93,14 @@ bool ClangFormatSettings::formatOnSave() const return m_formatOnSave; } +void ClangFormatSettings::setOverrideDefaultFile(bool enable) +{ + m_overrideDefaultFile = enable; +} + +bool ClangFormatSettings::overrideDefaultFile() const +{ + return m_overrideDefaultFile; +} + } // namespace ClangFormat |