diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-07-22 19:07:13 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-13 05:43:51 +0000 |
commit | 8b23133e50b01dd1daf53b0e7561719c17a043d6 (patch) | |
tree | 32454fe70e84d1ec692ca5dee703c36c5a487479 /src/gui/text | |
parent | d6d76df9e0ed0e9e6c761a1d3c2581ec317d3ebb (diff) |
Move QTextFormatPrivate::Property out of the class
This allows us to have the Q_DECLARE_PROPERTY before the
QVector<Property> 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 <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextformat.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
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<QTextFormatPrivate::Property> &otherProps = other.d->props; + const QVector<QT_PREPEND_NAMESPACE(Property)> &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); } } |