diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.h | 5 |
5 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 973c9da96c..c17ea9c878 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7441,7 +7441,7 @@ start_lengthVariant: } } - QList<QTextLayout::FormatRange> underlineFormats; + QVector<QTextLayout::FormatRange> underlineFormats; int length = offset - old_offset; if ((hidemnmemonic || showmnemonic) && maxUnderlines > 0) { QChar *cout = text.data() + old_offset; @@ -7515,7 +7515,7 @@ start_lengthVariant: engine.forceJustification = true; QTextLayout textLayout(&engine); textLayout.setCacheEnabled(true); - textLayout.setAdditionalFormats(underlineFormats); + textLayout.setFormats(underlineFormats); if (finalText.isEmpty()) { height = fm.height(); 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; diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index d3b70aaf26..3d248f4afc 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1949,7 +1949,7 @@ void QTextDocument::print(QPagedPaintDevice *printer) const for (QTextBlock srcBlock = firstBlock(), dstBlock = clonedDoc->firstBlock(); srcBlock.isValid() && dstBlock.isValid(); srcBlock = srcBlock.next(), dstBlock = dstBlock.next()) { - dstBlock.layout()->setAdditionalFormats(srcBlock.layout()->additionalFormats()); + dstBlock.layout()->setFormats(srcBlock.layout()->formats()); } QAbstractTextDocumentLayout *layout = doc->documentLayout(); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index dabe06fa88..c42054c07c 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE for a specified area in the text layout's content. \inmodule QtGui - \sa QTextLayout::setAdditionalFormats(), QTextLayout::draw() + \sa QTextLayout::setFormats(), QTextLayout::draw() */ /*! @@ -541,7 +541,7 @@ QVector<QTextLayout::FormatRange> QTextLayout::formats() const */ void QTextLayout::clearAdditionalFormats() { - setAdditionalFormats(QList<FormatRange>()); + clearFormats(); } /*! diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index ce092e0928..9709af4fd1 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -125,6 +125,11 @@ public: int start; int length; QTextCharFormat format; + + friend bool operator==(const FormatRange &lhs, const FormatRange &rhs) + { return lhs.start == rhs.start && lhs.length == rhs.length && lhs.format == rhs.format; } + friend bool operator!=(const FormatRange &lhs, const FormatRange &rhs) + { return !operator==(lhs, rhs); } }; void setAdditionalFormats(const QList<FormatRange> &overrides); QList<FormatRange> additionalFormats() const; |