From 4cbc19d3dc05293380cd36542b5ab057aad4212b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 20 Jul 2015 01:33:15 +0200 Subject: 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) --- src/corelib/itemmodels/qitemselectionmodel.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/corelib/itemmodels/qitemselectionmodel.h') 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) {} -- cgit v1.2.3