Farewell Q_DISABLE_MOVE

In hindsight, this macro is an API mistake, as it should NEVER be used
alone, but always in combination with Q_DISABLE_COPY. But in that case,
there's a better macro: Q_DISABLE_COPY_MOVE; hence this API is either
bad, or completely redundant.

A GitHub search reveals that luckily there's a handful of usages in the
wild (of which 0 in Qt/dev and KDE). Hence, I'm going for the kill, and
removing it entirely.

[ChangeLog][Source-Incompatible Changes][QtGlobal] The Q_DISABLE_MOVE
macro has been removed. Code that was using it can be ported to
Q_DISABLE_COPY_MOVE instead.

Change-Id: I7e346f7e2288f3f5a45315f4f6bfaeb2661f1de5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2021-05-21 16:41:34 +02:00
parent f20edffcc8
commit 4b60cea602
2 changed files with 5 additions and 19 deletions

View File

@ -651,18 +651,7 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
application would probably crash when you called a member function application would probably crash when you called a member function
of \c{w}. of \c{w}.
\sa Q_DISABLE_COPY_MOVE, Q_DISABLE_MOVE \sa Q_DISABLE_COPY_MOVE
*/
/*!
\macro Q_DISABLE_MOVE(Class)
\relates QObject
Disables the use of move constructors and move assignment operators
for the given \a Class.
\sa Q_DISABLE_COPY, Q_DISABLE_COPY_MOVE
\since 5.13
*/ */
/*! /*!
@ -671,9 +660,9 @@ static_assert(sizeof(qint64) == 8, "Internal error, qint64 is misdefined");
A convenience macro that disables the use of copy constructors, assignment A convenience macro that disables the use of copy constructors, assignment
operators, move constructors and move assignment operators for the given operators, move constructors and move assignment operators for the given
\a Class, combining Q_DISABLE_COPY and Q_DISABLE_MOVE. \a Class.
\sa Q_DISABLE_COPY, Q_DISABLE_MOVE \sa Q_DISABLE_COPY
\since 5.13 \since 5.13
*/ */

View File

@ -491,13 +491,10 @@ constexpr inline Deprecated_t Deprecated = {};
Class(const Class &) = delete;\ Class(const Class &) = delete;\
Class &operator=(const Class &) = delete; Class &operator=(const Class &) = delete;
#define Q_DISABLE_MOVE(Class) \
Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
#define Q_DISABLE_COPY_MOVE(Class) \ #define Q_DISABLE_COPY_MOVE(Class) \
Q_DISABLE_COPY(Class) \ Q_DISABLE_COPY(Class) \
Q_DISABLE_MOVE(Class) Class(Class &&) = delete; \
Class &operator=(Class &&) = delete;
/* /*
Implementing a move assignment operator using an established Implementing a move assignment operator using an established