summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-25 10:17:08 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-07-06 12:47:09 +0000
commit49403ef7a2731486df3793c07c010099715ba1be (patch)
treefc1cb4dc69d7ca1fa459bc8332ab1dfb2fa51725
parent82f48c7d326fb599e82c9a92d856fab531012591 (diff)
QIcon: use (Qt-) canonical form of move special member functions
In particular the move constructor now performs only two instead of four assignments. Change-Id: I033d75635288fbd44060a1ba5f2da23b7e7729f6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
-rw-r--r--src/gui/image/qicon.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 63e77eef99..c33a1f2698 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -56,8 +56,8 @@ public:
QIcon(const QIcon &other);
#ifdef Q_COMPILER_RVALUE_REFS
QIcon(QIcon &&other) Q_DECL_NOEXCEPT
- : d(0)
- { qSwap(d, other.d); }
+ : d(other.d)
+ { other.d = Q_NULLPTR; }
#endif
explicit QIcon(const QString &fileName); // file or resource name
explicit QIcon(QIconEngine *engine);
@@ -65,7 +65,7 @@ public:
QIcon &operator=(const QIcon &other);
#ifdef Q_COMPILER_RVALUE_REFS
inline QIcon &operator=(QIcon &&other) Q_DECL_NOEXCEPT
- { qSwap(d, other.d); return *this; }
+ { swap(other); return *this; }
#endif
inline void swap(QIcon &other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); }