Files
qt-creator/share/qtcreator/templates/wizards/classes/cpp/file.cpp
Marco Bubke c53a8da3a1 Honor Rule of three (or five) in the class wizard
It is very often a mistake to define a destructor without a copy (and move)
constructor and assignment operator. In C++11 no move constructor and
assignment operator will be generated if a destructor is defined. So it is
better to omit a lonely destructor in out template.

https://en.wikipedia.org/wiki/Rule_of_three_%28C%2B%2B_programming%29

Change-Id: If911556f872d878939f0f2fcaa974494a4df8a8a
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2014-11-27 13:50:35 +01:00

42 lines
838 B
C++

%{Cpp:LicenseTemplate}\
#include "%{HdrFileName}"
%{JS: Cpp.openNamespaces('%{Class}')}
@if '%{IncludeQSharedData}'
class %{CN}Data : public QSharedData
{
public:
};
@endif
@if '%{Base}' === 'QObject'
%{CN}::%{CN}(QObject *parent) : QObject(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''}
@elsif '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow'
%{CN}::%{CN}(QWidget *parent) : %{Base}(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''}
@else
%{CN}::%{CN}()%{JS: ('%{SharedDataInit}') ? ' : %{SharedDataInit}' : ''}
@endif
{
}
@if '%{IncludeQSharedData}'
%{CN}::%{CN}(const %{CN} &rhs) : data(rhs.data)
{
}
%{CN} &%{CN}::operator=(const %{CN} &rhs)
{
if (this != &rhs)
data.operator=(rhs.data);
return *this;
}
%{CN}::~%{CN}()
{
}
@endif
%{JS: Cpp.closeNamespaces('%{Class}')}\