diff options
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qicon.h | 7 | ||||
-rw-r--r-- | src/gui/image/qimage.h | 7 | ||||
-rw-r--r-- | src/gui/image/qpicture.h | 3 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 3 |
4 files changed, 8 insertions, 12 deletions
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h index 964c29e785..fab8c3fe21 100644 --- a/src/gui/image/qicon.h +++ b/src/gui/image/qicon.h @@ -62,14 +62,13 @@ public: QIcon(const QPixmap &pixmap); QIcon(const QIcon &other); QIcon(QIcon &&other) noexcept - : d(other.d) - { other.d = nullptr; } + : d(qExchange(other.d, nullptr)) + {} explicit QIcon(const QString &fileName); // file or resource name explicit QIcon(QIconEngine *engine); ~QIcon(); QIcon &operator=(const QIcon &other); - inline QIcon &operator=(QIcon &&other) noexcept - { swap(other); return *this; } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QIcon) inline void swap(QIcon &other) noexcept { qSwap(d, other.d); } bool operator==(const QIcon &) const = delete; diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 89a696d5d6..d00c11b669 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -125,13 +125,12 @@ public: QImage(const QImage &); inline QImage(QImage &&other) noexcept - : QPaintDevice(), d(nullptr) - { qSwap(d, other.d); } + : QPaintDevice(), d(qExchange(other.d, nullptr)) + {} ~QImage(); QImage &operator=(const QImage &); - inline QImage &operator=(QImage &&other) noexcept - { qSwap(d, other.d); return *this; } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QImage) inline void swap(QImage &other) noexcept { qSwap(d, other.d); } diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index 34860985ed..c3e622a1fe 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -77,8 +77,7 @@ public: void setBoundingRect(const QRect &r); QPicture& operator=(const QPicture &p); - inline QPicture &operator=(QPicture &&other) noexcept - { qSwap(d_ptr, other.d_ptr); return *this; } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPicture) inline void swap(QPicture &other) noexcept { d_ptr.swap(other.d_ptr); } void detach(); diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index b30bef0f6b..e731597659 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -75,8 +75,7 @@ public: ~QPixmap(); QPixmap &operator=(const QPixmap &); - inline QPixmap &operator=(QPixmap &&other) noexcept - { qSwap(data, other.data); return *this; } + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPixmap) inline void swap(QPixmap &other) noexcept { qSwap(data, other.data); } bool operator==(const QPixmap &) const = delete; |