diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.cpp b/share/qtcreator/templates/wizards/classes/cpp/file.cpp index 760f19c2e7b..57f55f2bbb4 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.cpp +++ b/share/qtcreator/templates/wizards/classes/cpp/file.cpp @@ -1,5 +1,10 @@ %{JS: Cpp.licenseTemplate()}\ #include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" + +@if '%{IncludeQSharedData}' +#include + +@endif %{JS: Cpp.openNamespaces('%{Class}')} @if '%{IncludeQSharedData}' class %{CN}Data : public QSharedData @@ -32,10 +37,23 @@ public: } +%{CN}::%{CN}(%{CN} &&rhs) + : data{std::move(rhs.data)} +{ + +} + %{CN} &%{CN}::operator=(const %{CN} &rhs) { if (this != &rhs) - data.operator=(rhs.data); + data = rhs.data; + return *this; +} + +%{CN} &%{CN}::operator=(%{CN} &&rhs) +{ + if (this != &rhs) + data = std::move(rhs.data); return *this; } diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.h b/share/qtcreator/templates/wizards/classes/cpp/file.h index 5dac9614e26..beaa86548f4 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.h +++ b/share/qtcreator/templates/wizards/classes/cpp/file.h @@ -44,7 +44,9 @@ public: @endif @if '%{IncludeQSharedData}' %{CN}(const %{CN} &); + %{CN}(%{CN} &&); %{CN} &operator=(const %{CN} &); + %{CN} &operator=(%{CN} &&); ~%{CN}(); @endif @if %{isQObject}