ClangFormat: Fix unsaving properties for global settings

- Fixed behavior "Formatting mode" combobox settings isn't
saved after pressing "Ok" button when no one project is
open. Now it works as expected, settings save after press
"Ok" button.
- Added additional applying interface for ICodeStylePreferenceFactory
which allows pass-through apply call from dialog to the editor.

Note: it doesn't work with read-only code style profiles

Change-Id: If4f0c85e3105550db4ffd9860e94b678f0d9b386
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-03-29 15:48:15 +02:00
parent 974d37d58a
commit 059d20ed22
15 changed files with 39 additions and 26 deletions

View File

@@ -97,7 +97,7 @@ static void applyRefactorings(QTextDocument *textDocument, TextEditorWidget *edi
// ------------------ CppCodeStyleSettingsWidget
CppCodeStylePreferencesWidget::CppCodeStylePreferencesWidget(QWidget *parent)
: QWidget(parent),
: TextEditor::CodeStyleEditorWidget(parent),
m_ui(new Ui::CppCodeStyleSettingsPage)
{
m_ui->setupUi(this);
@@ -363,9 +363,17 @@ void CppCodeStylePreferencesWidget::addTab(CppCodeStyleWidget *page, QString tab
connect(this, &CppCodeStylePreferencesWidget::tabSettingsChanged,
page, &CppCodeStyleWidget::setTabSettings);
connect(this, &CppCodeStylePreferencesWidget::applyEmitted,
page, &CppCodeStyleWidget::apply);
page->synchronize();
}
void CppCodeStylePreferencesWidget::apply()
{
emit applyEmitted();
}
// ------------------ CppCodeStyleSettingsPage
CppCodeStyleSettingsPage::CppCodeStyleSettingsPage()