summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qsyntaxhighlighter.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-02-21 15:15:29 +0100
committerKonstantin Ritt <ritt.ks@gmail.com>2015-05-30 10:56:24 +0000
commit87d57d19941fba4a921020480ca5761f23536c93 (patch)
tree9157982715d32e8a9c014fbdc104d9721aac525f /src/gui/text/qsyntaxhighlighter.cpp
parent9eff0dd19d6507ec400f036dd27efe960e4e5f78 (diff)
Fix users of QTextLayout::additionalFormats to use the new API
QTextLayout::additionalFormats setters and getters using QList<FormatRange> have been deprecated; port to the QVector versions. Moved op== definition for FormatRange needed in tst_qsyntaxhighlighter.cpp to a friend declaration in FormatRange itself, because MSVC 2008 doesn't find it otherwise. Change-Id: Ibab6589df057f02377d895079b56395859e3401e Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui/text/qsyntaxhighlighter.cpp')
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 162c646a98..f180a839b7 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -90,13 +90,13 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
QTextLayout *layout = currentBlock.layout();
- QList<QTextLayout::FormatRange> ranges = layout->additionalFormats();
+ QVector<QTextLayout::FormatRange> ranges = layout->formats();
const int preeditAreaStart = layout->preeditAreaPosition();
const int preeditAreaLength = layout->preeditAreaText().length();
if (preeditAreaLength != 0) {
- QList<QTextLayout::FormatRange>::Iterator it = ranges.begin();
+ QVector<QTextLayout::FormatRange>::Iterator it = ranges.begin();
while (it != ranges.end()) {
if (it->start >= preeditAreaStart
&& it->start + it->length <= preeditAreaStart + preeditAreaLength) {
@@ -142,7 +142,7 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
}
if (formatsChanged) {
- layout->setAdditionalFormats(ranges);
+ layout->setFormats(ranges);
doc->markContentsDirty(currentBlock.position(), currentBlock.length());
}
}
@@ -329,7 +329,7 @@ void QSyntaxHighlighter::setDocument(QTextDocument *doc)
QTextCursor cursor(d->doc);
cursor.beginEditBlock();
for (QTextBlock blk = d->doc->begin(); blk.isValid(); blk = blk.next())
- blk.layout()->clearAdditionalFormats();
+ blk.layout()->clearFormats();
cursor.endEditBlock();
}
d->doc = doc;