diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-06-25 18:41:14 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-06-30 16:34:26 +0000 |
commit | 6aaac9a3b19115272faeff2a7a2275c2538fc197 (patch) | |
tree | 28b31313c745d98f49e8b81bad2a4d3df7562243 /src/gui/painting | |
parent | 65343eb28369823fd0c86384b488c3b7440d908a (diff) |
QtGui: make all Q_DECLARE_SHARED types nothrow move-assignable
Excepting QBitmap and the QTextFormat heirarchy, which don't
have 100% value semantics (still pondering them).
In QPolygon(F), adding the move assignment operator disables
the implicitly-defined copy assignment operator, which therefore
have to be made user-defined. That doesn't change the ABI of
the class, since the base class QVector already had a user-defined
copy assignment operator.
Change-Id: I0b111c1d21cf47f559ada6357c982e3dc26aca68
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpagelayout.h | 11 | ||||
-rw-r--r-- | src/gui/painting/qpagesize.h | 10 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.h | 10 |
3 files changed, 19 insertions, 12 deletions
diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h index 17e5eeece2..7eac348c43 100644 --- a/src/gui/painting/qpagelayout.h +++ b/src/gui/painting/qpagelayout.h @@ -75,14 +75,13 @@ public: const QMarginsF &margins, Unit units = Point, const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0)); QPageLayout(const QPageLayout &other); - ~QPageLayout(); - - QPageLayout &operator=(const QPageLayout &other); - #ifdef Q_COMPILER_RVALUE_REFS - QPageLayout &operator=(QPageLayout &&other) { swap(other); return *this; } +#ifdef Q_COMPILER_RVALUE_REFS + QPageLayout &operator=(QPageLayout &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif + QPageLayout &operator=(const QPageLayout &other); + ~QPageLayout(); - void swap(QPageLayout &other) { d.swap(other.d); } + void swap(QPageLayout &other) Q_DECL_NOTHROW { qSwap(d, other.d); } friend Q_GUI_EXPORT bool operator==(const QPageLayout &lhs, const QPageLayout &rhs); bool isEquivalentTo(const QPageLayout &other) const; diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h index 00e22a243f..9119a582ac 100644 --- a/src/gui/painting/qpagesize.h +++ b/src/gui/painting/qpagesize.h @@ -229,14 +229,14 @@ public: const QString &name = QString(), SizeMatchPolicy matchPolicy = FuzzyMatch); QPageSize(const QPageSize &other); - ~QPageSize(); - - QPageSize &operator=(const QPageSize &other); #ifdef Q_COMPILER_RVALUE_REFS - QPageSize &operator=(QPageSize &&other) { swap(other); return *this; } + QPageSize &operator=(QPageSize &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif + QPageSize &operator=(const QPageSize &other); + ~QPageSize(); + - void swap(QPageSize &other) { d.swap(other.d); } + void swap(QPageSize &other) Q_DECL_NOTHROW { qSwap(d, other.d); } friend Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs); bool isEquivalentTo(const QPageSize &other) const; diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h index 1549ebe2b5..3890715f32 100644 --- a/src/gui/painting/qpolygon.h +++ b/src/gui/painting/qpolygon.h @@ -56,7 +56,11 @@ public: inline /*implicit*/ QPolygon(const QVector<QPoint> &v) : QVector<QPoint>(v) {} QPolygon(const QRect &r, bool closed=false); QPolygon(int nPoints, const int *points); - inline void swap(QPolygon &other) { QVector<QPoint>::swap(other); } // prevent QVector<QPoint><->QPolygon swaps +#ifdef Q_COMPILER_RVALUE_REFS + QPolygon &operator=(QPolygon &&other) Q_DECL_NOTHROW { swap(other); return *this; } +#endif + QPolygon &operator=(const QPolygon &other) { QVector<QPoint>::operator=(other); return *this; } + void swap(QPolygon &other) Q_DECL_NOTHROW { QVector<QPoint>::swap(other); } // prevent QVector<QPoint><->QPolygon swaps operator QVariant() const; @@ -130,6 +134,10 @@ public: inline /*implicit*/ QPolygonF(const QVector<QPointF> &v) : QVector<QPointF>(v) {} QPolygonF(const QRectF &r); /*implicit*/ QPolygonF(const QPolygon &a); +#ifdef Q_COMPILER_RVALUE_REFS + QPolygonF &operator=(QPolygonF &&other) Q_DECL_NOTHROW { swap(other); return *this; } +#endif + QPolygonF &operator=(const QPolygonF &other) { QVector<QPointF>::operator=(other); return *this; } inline void swap(QPolygonF &other) { QVector<QPointF>::swap(other); } // prevent QVector<QPointF><->QPolygonF swaps operator QVariant() const; |