From 8b23133e50b01dd1daf53b0e7561719c17a043d6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Jul 2016 19:07:13 -0700 Subject: Move QTextFormatPrivate::Property out of the class This allows us to have the Q_DECLARE_PROPERTY before the QVector use. Not important for Qt 5, but it helps me. The operator!= function is never called, so it can be dropped (caught by ICC 17 beta). Change-Id: I149e0540c00745fe8119fffd1463c9bc1b356ec6 Reviewed-by: Edward Welbourne --- src/gui/text/qtextformat.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 36e0a77bd0..f992bc75e6 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -164,24 +164,25 @@ QDataStream &operator>>(QDataStream &stream, QTextLength &length) } #endif // QT_NO_DATASTREAM -class QTextFormatPrivate : public QSharedData +namespace { +struct Property { -public: - QTextFormatPrivate() : hashDirty(true), fontDirty(true), hashValue(0) {} + inline Property(qint32 k, const QVariant &v) : key(k), value(v) {} + inline Property() {} - struct Property - { - inline Property(qint32 k, const QVariant &v) : key(k), value(v) {} - inline Property() {} + qint32 key; + QVariant value; - qint32 key; - QVariant value; + inline bool operator==(const Property &other) const + { return key == other.key && value == other.value; } +}; +} +Q_DECLARE_TYPEINFO(Property, Q_MOVABLE_TYPE); - inline bool operator==(const Property &other) const - { return key == other.key && value == other.value; } - inline bool operator!=(const Property &other) const - { return key != other.key || value != other.value; } - }; +class QTextFormatPrivate : public QSharedData +{ +public: + QTextFormatPrivate() : hashDirty(true), fontDirty(true), hashValue(0) {} inline uint hash() const { @@ -263,7 +264,6 @@ private: friend QDataStream &operator<<(QDataStream &, const QTextFormat &); friend QDataStream &operator>>(QDataStream &, QTextFormat &); }; -Q_DECLARE_TYPEINFO(QTextFormatPrivate::Property, Q_MOVABLE_TYPE); static inline uint hash(const QColor &color) { @@ -845,10 +845,10 @@ void QTextFormat::merge(const QTextFormat &other) QTextFormatPrivate *d = this->d; - const QVector &otherProps = other.d->props; + const QVector &otherProps = other.d->props; d->props.reserve(d->props.size() + otherProps.size()); for (int i = 0; i < otherProps.count(); ++i) { - const QTextFormatPrivate::Property &p = otherProps.at(i); + const QT_PREPEND_NAMESPACE(Property) &p = otherProps.at(i); d->insertProperty(p.key, p.value); } } -- cgit v1.2.3