C++: optimize the semantic highlighting in the UI thread.

Done by reserving enough space in for the various QLists when created,
and by preventing unnecessary copying of lists.

Change-Id: I5a9f0f7042bbaa1cf5eb076b956c35f2191468c6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
Erik Verbruggen
2013-02-26 11:17:13 +01:00
committed by Erik Verbruggen
parent ff6e100824
commit 97c6af9443
4 changed files with 20 additions and 14 deletions

View File

@@ -2008,7 +2008,8 @@ void CPPEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
// Clear all additional formats since they may have changed
QTextBlock b = document()->firstBlock();
while (b.isValid()) {
highlighter->setExtraAdditionalFormats(b, QList<QTextLayout::FormatRange>());
QList<QTextLayout::FormatRange> noFormats;
highlighter->setExtraAdditionalFormats(b, noFormats);
b = b.next();
}