forked from qt-creator/qt-creator
ClangFormat: Synchronize ClangFormat settings with CppEditor codestyle
Added synchronization between ClangFormat codestyle settings and CppEditors codestyle settings. All changes which will be done in ClangFormat settings tab settings tabs will be automatically retranslated to CppEditor codestyle settings tabs and vice versa. Change-Id: I408d726c12552856e3c1b72d3ba09b77fff83321 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <texteditor/displaysettings.h>
|
||||
#include <texteditor/snippets/snippetprovider.h>
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <cplusplus/Overview.h>
|
||||
#include <cplusplus/pp.h>
|
||||
@@ -222,6 +223,11 @@ void CppCodeStylePreferencesWidget::setTabSettings(const TabSettings &settings)
|
||||
m_ui->tabSettingsWidget->setTabSettings(settings);
|
||||
}
|
||||
|
||||
TextEditor::TabSettings CppCodeStylePreferencesWidget::tabSettings() const
|
||||
{
|
||||
return m_ui->tabSettingsWidget->tabSettings();
|
||||
}
|
||||
|
||||
void CppCodeStylePreferencesWidget::setCodeStyleSettings(const CppCodeStyleSettings &s, bool preview)
|
||||
{
|
||||
const bool wasBlocked = m_blockUpdates;
|
||||
@@ -274,7 +280,7 @@ void CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged()
|
||||
if (current)
|
||||
current->setCodeStyleSettings(cppCodeStyleSettings());
|
||||
}
|
||||
|
||||
emit codeStyleSettingsChanged(cppCodeStyleSettings());
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
@@ -289,6 +295,7 @@ void CppCodeStylePreferencesWidget::slotTabSettingsChanged(const TabSettings &se
|
||||
current->setTabSettings(settings);
|
||||
}
|
||||
|
||||
emit tabSettingsChanged(settings);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
@@ -337,9 +344,26 @@ void CppCodeStylePreferencesWidget::setVisualizeWhitespace(bool on)
|
||||
}
|
||||
}
|
||||
|
||||
void CppCodeStylePreferencesWidget::addTab(QWidget *page, QString tabName)
|
||||
void CppCodeStylePreferencesWidget::addTab(CppCodeStyleWidget *page, QString tabName)
|
||||
{
|
||||
QTC_ASSERT(page, return);
|
||||
m_ui->categoryTab->addTab(page, tabName);
|
||||
|
||||
connect(page, &CppEditor::CppCodeStyleWidget::codeStyleSettingsChanged,
|
||||
this, [this](const CppEditor::CppCodeStyleSettings &settings) {
|
||||
setCodeStyleSettings(settings, true);
|
||||
});
|
||||
|
||||
connect(page, &CppEditor::CppCodeStyleWidget::tabSettingsChanged,
|
||||
this, &CppCodeStylePreferencesWidget::setTabSettings);
|
||||
|
||||
connect(this, &CppCodeStylePreferencesWidget::codeStyleSettingsChanged,
|
||||
page, &CppCodeStyleWidget::setCodeStyleSettings);
|
||||
|
||||
connect(this, &CppCodeStylePreferencesWidget::tabSettingsChanged,
|
||||
page, &CppCodeStyleWidget::setTabSettings);
|
||||
|
||||
page->synchronize();
|
||||
}
|
||||
|
||||
// ------------------ CppCodeStyleSettingsPage
|
||||
|
||||
Reference in New Issue
Block a user