QtGui: add member-swap to shared classes

Implemented as in other shared classes (e.g. QPen).

Change-Id: I5b96d4a4795870d6252aa53de6fbaedde7c0095a
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
bb10
Marc Mutz 2012-04-05 14:49:02 +02:00 committed by Qt by Nokia
parent 6c59cdecee
commit f6f517bc54
16 changed files with 101 additions and 0 deletions

View File

@ -117,6 +117,8 @@ public:
QColorDialogOptions &operator=(const QColorDialogOptions &rhs);
~QColorDialogOptions();
void swap(QColorDialogOptions &other) { qSwap(d, other.d); }
QString windowTitle() const;
void setWindowTitle(const QString &);
@ -171,6 +173,8 @@ public:
QFontDialogOptions &operator=(const QFontDialogOptions &rhs);
~QFontDialogOptions();
void swap(QFontDialogOptions &other) { qSwap(d, other.d); }
QString windowTitle() const;
void setWindowTitle(const QString &);
@ -226,6 +230,8 @@ public:
QFileDialogOptions &operator=(const QFileDialogOptions &rhs);
~QFileDialogOptions();
void swap(QFileDialogOptions &other) { qSwap(d, other.d); }
QString windowTitle() const;
void setWindowTitle(const QString &);

View File

@ -738,6 +738,14 @@ QFont &QFont::operator=(const QFont &font)
return *this;
}
/*!
\fn void QFont::swap(QFont &other)
\since 5.0
Swaps this font instance with \a other. This function is very fast
and never fails.
*/
/*!
Returns the requested font family name, i.e. the name set in the
constructor or the last setFont() call.
@ -2293,6 +2301,14 @@ QFontInfo &QFontInfo::operator=(const QFontInfo &fi)
return *this;
}
/*!
\fn void QFontInfo::swap(QFontInfo &other)
\since 5.0
Swaps this font info instance with \a other. This function is very
fast and never fails.
*/
/*!
Returns the family name of the matched window system font.

View File

@ -161,6 +161,9 @@ public:
QFont(const QFont &);
~QFont();
void swap(QFont &other)
{ qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); }
QString family() const;
void setFamily(const QString &);

View File

@ -59,6 +59,8 @@ public:
QFontInfo &operator=(const QFontInfo &);
void swap(QFontInfo &other) { qSwap(d, other.d); }
QString family() const;
QString styleName() const;
int pixelSize() const;

View File

@ -213,6 +213,14 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
return *this;
}
/*!
\fn void QFontMetrics::swap(QFontMetrics &other)
\since 5.0
Swaps this font metrics instance with \a other. This function is
very fast and never fails.
*/
/*!
Returns true if \a other is equal to this object; otherwise
returns false.
@ -1004,6 +1012,16 @@ QFontMetricsF &QFontMetricsF::operator=(const QFontMetrics &other)
return *this;
}
/*!
\fn void QFontMetricsF::swap(QFontMetricsF &other)
\since 5.0
Swaps this font metrics instance with \a other. This function is
very fast and never fails.
*/
/*!
Constructs a font metrics object for \a font.

View File

@ -72,6 +72,8 @@ public:
{ qSwap(d, other.d); return *this; }
#endif
void swap(QFontMetrics &other) { qSwap(d, other.d); }
int ascent() const;
int descent() const;
int height() const;
@ -139,6 +141,9 @@ public:
inline QFontMetricsF &operator=(QFontMetricsF &&other)
{ qSwap(d, other.d); return *this; }
#endif
void swap(QFontMetricsF &other) { qSwap(d, other.d); }
qreal ascent() const;
qreal descent() const;
qreal height() const;

View File

@ -152,6 +152,14 @@ QGlyphRun &QGlyphRun::operator=(const QGlyphRun &other)
return *this;
}
/*!
\fn void QGlyphRun::swap(QGlyphRun &other)
\since 5.0
Swaps this glyph run instance with \a other. This function is very
fast and never fails.
*/
/*!
Compares \a other to this QGlyphRun object. Returns true if the list of glyph indexes,
the list of positions and the font are all equal, otherwise returns false.

View File

@ -71,6 +71,8 @@ public:
QGlyphRun(const QGlyphRun &other);
~QGlyphRun();
void swap(QGlyphRun &other) { qSwap(d, other.d); }
QRawFont rawFont() const;
void setRawFont(const QRawFont &rawFont);

View File

@ -185,6 +185,14 @@ QRawFont &QRawFont::operator=(const QRawFont &other)
return *this;
}
/*!
\fn void QRawFont::operator=(QRawFont &other)
\since 5.0
Swaps this raw font with \a other. This function is very fast and
never fails.
*/
/*!
Returns true if the QRawFont is valid and false otherwise.
*/

View File

@ -81,6 +81,8 @@ public:
QRawFont &operator=(const QRawFont &other);
void swap(QRawFont &other) { qSwap(d, other.d); }
bool operator==(const QRawFont &other) const;
inline bool operator!=(const QRawFont &other) const
{ return !operator==(other); }

View File

@ -223,6 +223,14 @@ QStaticText &QStaticText::operator=(const QStaticText &other)
return *this;
}
/*!
\fn void QStaticText::swap(QStaticText &other)
\since 5.0
Swaps this static text instance with \a other. This function is
very fast and never fails.
*/
/*!
Compares \a other to this QStaticText. Returns true if the texts, fonts and text widths
are equal.

View File

@ -69,6 +69,8 @@ public:
QStaticText(const QStaticText &other);
~QStaticText();
void swap(QStaticText &other) { qSwap(data, other.data); }
void setText(const QString &text);
QString text() const;

View File

@ -1118,6 +1118,14 @@ QTextCursor &QTextCursor::operator=(const QTextCursor &cursor)
return *this;
}
/*!
\fn void QTextCursor::swap(QTextCursor &other)
\since 5.0
Swaps this text cursor instance with \a other. This function is
very fast and never fails.
*/
/*!
Destroys the QTextCursor.
*/

View File

@ -79,6 +79,8 @@ public:
QTextCursor &operator=(const QTextCursor &other);
~QTextCursor();
void swap(QTextCursor &other) { qSwap(d, other.d); }
bool isNull() const;
enum MoveMode {

View File

@ -795,6 +795,14 @@ QTextFormat &QTextFormat::operator=(const QTextFormat &rhs)
return *this;
}
/*!
\fn void QTextFormat::swap(QTextFormat &other)
\since 5.0
Swaps this text format with \a other. This function is very fast
and never fails.
*/
/*!
Destroys this text format.
*/

View File

@ -291,6 +291,9 @@ public:
QTextFormat &operator=(const QTextFormat &rhs);
~QTextFormat();
void swap(QTextFormat &other)
{ qSwap(d, other.d); qSwap(format_type, other.format_type); }
void merge(const QTextFormat &other);
inline bool isValid() const { return type() != InvalidFormat; }