Merge remote-tracking branch 'origin/12.0'

Conflicts:
	src/plugins/clangformat/clangformatconfigwidget.cpp

Change-Id: I84fba4e6f952e9aca606951e7fb7763b451e35d9
This commit is contained in:
Eike Ziller
2024-01-03 13:05:56 +01:00
4 changed files with 24 additions and 3 deletions

View File

@@ -150,7 +150,9 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferenc
displaySettings.m_visualizeWhitespace = true;
m_preview->setDisplaySettings(displaySettings);
m_preview->setPlainText(QLatin1String(CppEditor::Constants::DEFAULT_CODE_STYLE_SNIPPETS[0]));
m_preview->textDocument()->setIndenter(new ClangFormatIndenter(m_preview->document()));
auto *indenter = new ClangFormatIndenter(m_preview->document());
indenter->setOverriddenPreferences(codeStyle);
m_preview->textDocument()->setIndenter(indenter);
m_preview->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
m_preview->textDocument()->resetSyntaxHighlighter(
[] { return new CppEditor::CppHighlighter(); });
@@ -288,7 +290,7 @@ void ClangFormatConfigWidget::updatePreview()
QTextCursor cursor(m_preview->document());
cursor.setPosition(0);
cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
m_preview->textDocument()->autoIndent(cursor);
m_preview->textDocument()->autoFormatOrIndent(cursor);
}
std::string ClangFormatConfigWidget::readFile(const QString &path)