forked from qt-creator/qt-creator
ClangFormat: Fix preview update
Fixes: QTCREATORBUG-30089 Change-Id: Id89e8b2ee0439c5235755256e8410f42ad94b432 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -129,7 +129,9 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferenc
|
||||
displaySettings.m_visualizeWhitespace = true;
|
||||
d->preview->setDisplaySettings(displaySettings);
|
||||
d->preview->setPlainText(QLatin1String(CppEditor::Constants::DEFAULT_CODE_STYLE_SNIPPETS[0]));
|
||||
d->preview->textDocument()->setIndenter(new ClangFormatIndenter(d->preview->document()));
|
||||
auto *indenter = new ClangFormatIndenter(d->preview->document());
|
||||
indenter->setOverriddenPreferences(codeStyle);
|
||||
d->preview->textDocument()->setIndenter(indenter);
|
||||
d->preview->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
|
||||
d->preview->textDocument()->setSyntaxHighlighter(new CppEditor::CppHighlighter);
|
||||
d->preview->textDocument()->indenter()->setFileName(fileName);
|
||||
@@ -271,7 +273,7 @@ void ClangFormatConfigWidget::updatePreview()
|
||||
QTextCursor cursor(d->preview->document());
|
||||
cursor.setPosition(0);
|
||||
cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
|
||||
d->preview->textDocument()->autoIndent(cursor);
|
||||
d->preview->textDocument()->autoFormatOrIndent(cursor);
|
||||
}
|
||||
|
||||
std::string ClangFormatConfigWidget::readFile(const QString &path)
|
||||
|
||||
Reference in New Issue
Block a user