summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-07-20 01:33:15 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-07-22 21:12:37 +0000
commit4cbc19d3dc05293380cd36542b5ab057aad4212b (patch)
treecd3399f890f23b8113a62462f1254c1f556f460d /src/corelib/itemmodels
parent562c01d04e6b779c754cc9e7164d48e91b92a0d1 (diff)
QItemSelectionRange: make nothrow move-assignable and -constructible
The move special members were inhibited by the presence of a user-defined copy ctor, which we cannot remove since the class is exported. Change-Id: I7118588b808387f2733d93216c8c3b117666bb9e Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/itemmodels')
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index 4013beb539..09b710175e 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -49,8 +49,19 @@ class Q_CORE_EXPORT QItemSelectionRange
public:
inline QItemSelectionRange() : tl(), br() {}
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ // ### Qt 6: remove them all, the compiler-generated ones are fine
inline QItemSelectionRange(const QItemSelectionRange &other)
: tl(other.tl), br(other.br) {}
+# ifdef Q_COMPILER_RVALUE_REFS
+ QItemSelectionRange(QItemSelectionRange &&other) Q_DECL_NOTHROW
+ : tl(std::move(other.tl)), br(std::move(other.br)) {}
+ QItemSelectionRange &operator=(QItemSelectionRange &&other) Q_DECL_NOTHROW
+ { tl = std::move(other.tl); br = std::move(other.br); return *this; }
+# endif
+ QItemSelectionRange &operator=(const QItemSelectionRange &other)
+ { tl = other.tl; br = other.br; return *this; }
+#endif // Qt < 6
QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR) : tl(topL), br(bottomR) {}
explicit QItemSelectionRange(const QModelIndex &index) : tl(index), br(tl) {}