summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextformat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtextformat.cpp')
-rw-r--r--src/gui/text/qtextformat.cpp74
1 files changed, 39 insertions, 35 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 36e0a77bd0..08106db6ce 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 = -1;
+ 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
{
@@ -200,8 +201,10 @@ public:
inline void insertProperty(qint32 key, const QVariant &value)
{
hashDirty = true;
- if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ || key == QTextFormat::FontLetterSpacingType) {
fontDirty = true;
+ }
for (int i = 0; i < props.count(); ++i)
if (props.at(i).key == key) {
props[i].value = value;
@@ -215,8 +218,10 @@ public:
for (int i = 0; i < props.count(); ++i)
if (props.at(i).key == key) {
hashDirty = true;
- if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ || key == QTextFormat::FontLetterSpacingType) {
fontDirty = true;
+ }
props.remove(i);
return;
}
@@ -263,7 +268,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 +849,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);
}
}
@@ -1333,9 +1337,9 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value DashDotLine Dashs and dots are drawn using Qt::DashDotLine.
\value DashDotDotLine Underlines draw drawn using Qt::DashDotDotLine.
\value WaveUnderline The text is underlined using a wave shaped line.
- \value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle
- style hint of the QApplication style. By default this is mapped to
- WaveUnderline, on \macos it is mapped to DashDotLine.
+ \value SpellCheckUnderline The underline is drawn depending on the SpellCheckUnderlineStyle
+ theme hint of QPlatformTheme. By default this is mapped to
+ WaveUnderline, on \macos it is mapped to DotLine.
\sa Qt::PenStyle
*/
@@ -2584,13 +2588,13 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
}
/*!
- \fn QTextFrameFormat::isValid() const
+ \fn bool QTextFrameFormat::isValid() const
Returns \c true if the format description is valid; otherwise returns \c false.
*/
/*!
- \fn QTextFrameFormat::setPosition(Position policy)
+ \fn void QTextFrameFormat::setPosition(Position policy)
Sets the \a policy for positioning frames with this frame format.
@@ -2603,7 +2607,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setBorder(qreal width)
+ \fn void QTextFrameFormat::setBorder(qreal width)
Sets the \a width (in pixels) of the frame's border.
*/
@@ -2615,7 +2619,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setBorderBrush(const QBrush &brush)
+ \fn void QTextFrameFormat::setBorderBrush(const QBrush &brush)
\since 4.3
Sets the \a brush used for the frame's border.
@@ -2629,7 +2633,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setBorderStyle(BorderStyle style)
+ \fn void QTextFrameFormat::setBorderStyle(BorderStyle style)
\since 4.3
Sets the \a style of the frame's border.
@@ -2643,7 +2647,7 @@ QTextFrameFormat::QTextFrameFormat(const QTextFormat &fmt)
*/
/*!
- \fn QTextFrameFormat::setMargin(qreal margin)
+ \fn void QTextFrameFormat::setMargin(qreal margin)
Sets the frame's \a margin in pixels.
This method also sets the left, right, top and bottom margins
@@ -2667,7 +2671,7 @@ void QTextFrameFormat::setMargin(qreal amargin)
*/
/*!
- \fn QTextFrameFormat::setTopMargin(qreal margin)
+ \fn void QTextFrameFormat::setTopMargin(qreal margin)
\since 4.3
Sets the frame's top \a margin in pixels.
@@ -2687,7 +2691,7 @@ qreal QTextFrameFormat::topMargin() const
}
/*!
- \fn QTextFrameFormat::setBottomMargin(qreal margin)
+ \fn void QTextFrameFormat::setBottomMargin(qreal margin)
\since 4.3
Sets the frame's bottom \a margin in pixels.
@@ -2707,7 +2711,7 @@ qreal QTextFrameFormat::bottomMargin() const
}
/*!
- \fn QTextFrameFormat::setLeftMargin(qreal margin)
+ \fn void QTextFrameFormat::setLeftMargin(qreal margin)
\since 4.3
Sets the frame's left \a margin in pixels.
@@ -2727,7 +2731,7 @@ qreal QTextFrameFormat::leftMargin() const
}
/*!
- \fn QTextFrameFormat::setRightMargin(qreal margin)
+ \fn void QTextFrameFormat::setRightMargin(qreal margin)
\since 4.3
Sets the frame's right \a margin in pixels.
@@ -2747,7 +2751,7 @@ qreal QTextFrameFormat::rightMargin() const
}
/*!
- \fn QTextFrameFormat::setPadding(qreal width)
+ \fn void QTextFrameFormat::setPadding(qreal width)
Sets the \a width of the frame's internal padding in pixels.
*/
@@ -2759,7 +2763,7 @@ qreal QTextFrameFormat::rightMargin() const
*/
/*!
- \fn QTextFrameFormat::setWidth(const QTextLength &width)
+ \fn void QTextFrameFormat::setWidth(const QTextLength &width)
Sets the frame's border rectangle's \a width.
@@ -2767,7 +2771,7 @@ qreal QTextFrameFormat::rightMargin() const
*/
/*!
- \fn QTextFrameFormat::setWidth(qreal width)
+ \fn void QTextFrameFormat::setWidth(qreal width)
\overload
Convenience method that sets the width of the frame's border