From c0ddd5fa12f696838cb1d1de3f721f19a87c8509 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 20 Feb 2014 17:16:29 +0100 Subject: QTextLayout: replace a use of an inefficient QList with QVector The QTextLayout::FormatRange is larger than void* and thus should not be held in QList. Use a QVector instead. Other parts of Qt already hold FormatRanges in QVectors, so this also makes handling FormatRanges more consistent. To avoid ugly names for the getter which doesn't overload on return type alone), rename the set of function to format (from additionalFormats). [ChangeLog][QtGui][QTextLayout] Added QVector-based alternatives setFormat(), format(), and clearFormat() to setAdditionalFormats(), additionalFormats(), and clearAdditionalFormats(), resp. Change-Id: Ie04a561b43c91c3b2befb3cac2981821f84d5f77 Reviewed-by: Konstantin Ritt Reviewed-by: Simon Hausmann --- src/gui/text/qtextengine_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui/text/qtextengine_p.h') diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 39b9e0cb5a..3590c6da07 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -570,9 +570,9 @@ public: inline bool hasFormats() const { return block.docHandle() || (specialData && !specialData->formats.isEmpty()); } - inline QList formats() const - { return specialData ? specialData->formats : QList(); } - void setFormats(const QList &formats); + inline QVector formats() const + { return specialData ? specialData->formats : QVector(); } + void setFormats(const QVector &formats); private: static void init(QTextEngine *e); @@ -580,7 +580,7 @@ private: struct SpecialData { int preeditPosition; QString preeditText; - QList formats; + QVector formats; QVector resolvedFormats; // only used when no docHandle is available QScopedPointer formatCollection; -- cgit v1.2.3