Commit 8902428e authored by Igor Kushnir's avatar Igor Kushnir
Browse files

ScopedDialog: Q_DISABLE_COPY => Q_DISABLE_COPY_MOVE

Move constructor and move assignment operator have to be defaulted or
deleted to follow the rule of five. ScopedDialog is supposed to live
inside a specific scope, so moving it doesn't make sense. A similar
class template QScopedPointer is also not movable. So let us define the
move operations as deleted via Q_DISABLE_COPY_MOVE.

Unlike Q_DISABLE_COPY, Q_DISABLE_COPY_MOVE prevents the forwarding
constructor from acting as a move constructor. So the following code
    ScopedDialog<QDialog> s;
    ScopedDialog<QDialog> s2(std::move(s));
compiled before, but does not compile at this commit.

Move this declaration closer to other special member functions.
parent 90a84519
......@@ -42,6 +42,7 @@ namespace KDevelop {
template<typename DialogType>
class ScopedDialog
{
Q_DISABLE_COPY_MOVE(ScopedDialog)
public:
/// Construct the dialog with any set of allowed arguments
/// for the construction of DialogType
......@@ -77,8 +78,6 @@ public:
}
private:
Q_DISABLE_COPY(ScopedDialog)
QPointer<DialogType> ptr;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment