diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2010-11-02 14:20:38 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-03 10:50:48 (GMT) |
commit | 86ea8521c6f145be24c40c799b6b4e8f6e854e2b (patch) | |
tree | bbceb07abeb3f8b974287ea648fd995b4ba8345c /src/gui | |
parent | d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (diff) | |
download | Qt-86ea8521c6f145be24c40c799b6b4e8f6e854e2b.zip Qt-86ea8521c6f145be24c40c799b6b4e8f6e854e2b.tar.gz Qt-86ea8521c6f145be24c40c799b6b4e8f6e854e2b.tar.bz2 |
Add member-swap to shared datatypes that don't have it.
For consistency.
Merge-request: 871
Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qbitmap.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qbitmap.h | 1 | ||||
-rw-r--r-- | src/gui/image/qicon.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qicon.h | 2 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qimage.h | 1 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qpicture.h | 1 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qbrush.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qbrush.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpen.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qpen.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qregion.h | 1 |
21 files changed, 96 insertions, 0 deletions
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index 91622f3..9d90b3f 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -227,6 +227,14 @@ QBitmap::~QBitmap() } /*! + \fn void QBitmap::swap(QBitmap &other) + \since 4.8 + + Swaps bitmap \a other with this bitmap. This operation is very + fast and never fails. +*/ + +/*! Returns the bitmap as a QVariant. */ QBitmap::operator QVariant() const diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h index 1bbe1cf..93be951 100644 --- a/src/gui/image/qbitmap.h +++ b/src/gui/image/qbitmap.h @@ -63,6 +63,7 @@ public: ~QBitmap(); QBitmap &operator=(const QPixmap &); + inline void swap(QBitmap &other) { QPixmap::swap(other); } // prevent QBitmap<->QPixmap swaps operator QVariant() const; inline void clear() { fill(Qt::color0); } diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index a2f429a..e54bb5f 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -613,6 +613,14 @@ QIcon &QIcon::operator=(const QIcon &other) } /*! + \fn void QIcon::swap(QIcon &other) + \since 4.8 + + Swaps icon \a other with this icon. This operation is very + fast and never fails. +*/ + +/*! Returns the icon as a QVariant. */ QIcon::operator QVariant() const diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h index fd591e6..5091d03 100644 --- a/src/gui/image/qicon.h +++ b/src/gui/image/qicon.h @@ -75,6 +75,8 @@ public: inline QIcon &operator=(QIcon &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QIcon &other) { qSwap(d, other.d); } + operator QVariant() const; QPixmap pixmap(const QSize &size, Mode mode = Normal, State state = Off) const; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 5829fe8..d86021cb9 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1329,6 +1329,14 @@ QImage &QImage::operator=(const QImage &image) } /*! + \fn void QImage::swap(QImage &other) + \since 4.8 + + Swaps image \a other with this image. This operation is very + fast and never fails. +*/ + +/*! \internal */ int QImage::devType() const diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 003daea..c6a947e 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -144,6 +144,7 @@ public: inline QImage &operator=(QImage &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QImage &other) { qSwap(d, other.d); } bool isNull() const; diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 48d2de3..fc81d23 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1030,6 +1030,14 @@ QPicture& QPicture::operator=(const QPicture &p) } /*! + \fn void QPicture::swap(QPicture &other) + \since 4.8 + + Swaps picture \a other with this picture. This operation is very + fast and never fails. +*/ + +/*! \internal Constructs a QPicturePrivate diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index 49b0fd6..d24f23a 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -85,6 +85,7 @@ public: inline QPicture &operator=(QPicture &&other) { qSwap(d_ptr, other.d_ptr); return *this; } #endif + inline void swap(QPicture &other) { d_ptr.swap(other.d_ptr); } void detach(); bool isDetached() const; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 5383b7c..1b370c0 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -440,6 +440,14 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap) } /*! + \fn void QPixmap::swap(QPixmap &other) + \since 4.8 + + Swaps pixmap \a other with this pixmap. This operation is very + fast and never fails. +*/ + +/*! Returns the pixmap as a QVariant. */ QPixmap::operator QVariant() const diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index e9f9365..15fe5fa 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -87,6 +87,8 @@ public: inline QPixmap &operator=(QPixmap &&other) { qSwap(data, other.data); return *this; } #endif + inline void swap(QPixmap &other) { qSwap(data, other.data); } + operator QVariant() const; bool isNull() const; // ### Qt 5: make inline diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index e14a9198..b4a360a 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1521,6 +1521,14 @@ QKeySequence &QKeySequence::operator=(const QKeySequence &other) } /*! + \fn void QKeySequence::swap(QKeySequence &other) + \since 4.8 + + Swaps key sequence \a other with this key sequence. This operation is very + fast and never fails. +*/ + +/*! \fn bool QKeySequence::operator!=(const QKeySequence &other) const Returns true if this key sequence is not equal to the \a other diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index b47873d..a2352eb 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -183,6 +183,7 @@ public: inline QKeySequence &operator=(QKeySequence &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QKeySequence &other) { qSwap(d, other.d); } bool operator==(const QKeySequence &other) const; inline bool operator!= (const QKeySequence &other) const { return !(*this == other); } diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d0788c7..5b35fc5 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -635,6 +635,15 @@ QBrush &QBrush::operator=(const QBrush &b) return *this; } + +/*! + \fn void QBrush::swap(QBrush &other) + \since 4.8 + + Swaps brush \a other with this brush. This operation is very + fast and never fails. +*/ + /*! Returns the brush as a QVariant */ diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index efc720b..f9acded 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -96,6 +96,8 @@ public: inline QBrush &operator=(QBrush &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QBrush &other) { qSwap(d, other.d); } + operator QVariant() const; inline Qt::BrushStyle style() const; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index ffd0d5c..7d6ea12 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -576,6 +576,14 @@ QPainterPath &QPainterPath::operator=(const QPainterPath &other) } /*! + \fn void QPainterPath::swap(QPainterPath &other) + \since 4.8 + + Swaps painter path \a other with this painter path. This operation is very + fast and never fails. +*/ + +/*! Destroys this QPainterPath object. */ QPainterPath::~QPainterPath() diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index 9a7b60a..82facf8 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -100,6 +100,7 @@ public: { qSwap(d_ptr, other.d_ptr); return *this; } #endif ~QPainterPath(); + inline void swap(QPainterPath &other) { d_ptr.swap(other.d_ptr); } void closeSubpath(); diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 2e43984..0137763 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -383,6 +383,14 @@ QPen &QPen::operator=(const QPen &p) } /*! + \fn void QPen::swap(QPen &other) + \since 4.8 + + Swaps pen \a other with this pen. This operation is very + fast and never fails. +*/ + +/*! Returns the pen as a QVariant. */ QPen::operator QVariant() const diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h index 4006112..a7b946c 100644 --- a/src/gui/painting/qpen.h +++ b/src/gui/painting/qpen.h @@ -78,6 +78,7 @@ public: inline QPen &operator=(QPen &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QPen &other) { qSwap(d, other.d); } Qt::PenStyle style() const; void setStyle(Qt::PenStyle); diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 76b11d7..83323d0 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -709,6 +709,8 @@ QPolygon QPolygonF::toPolygon() const /*! \fn void QPolygonF::swap(QPolygonF &other) + \since 4.8 + Swaps polygon \a other with this polygon. This operation is very fast and never fails. */ diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index c5d5dc9..cd997f4 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -391,6 +391,14 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt */ /*! + \fn void QRegion::swap(QRegion &other) + \since 4.8 + + Swaps region \a other with this region. This operation is very + fast and never fails. +*/ + +/*! \relates QRegion Writes the region \a r to the stream \a s and returns a reference diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index 91d82e0..50052b3 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -85,6 +85,7 @@ public: inline QRegion &operator=(QRegion &&other) { qSwap(d, other.d); return *this; } #endif + inline void swap(QRegion &other) { qSwap(d, other.d); } #ifdef QT3_SUPPORT inline QT3_SUPPORT bool isNull() const { return isEmpty(); } #endif |