Files
qt-creator/share/qtcreator/templates/wizards/classes/cpp/file.cpp
Loren Burkholder 6c0f2b1c63 Use a more logical code style
This adds C++11-style initializers and breaks the initializer list into a new line, since most classes will have other members to be put in new lines as well.

Change-Id: I7b6d6bf6f32dbd58a744405aefabb02be9f45316
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-22 16:38:41 +00:00

48 lines
1.1 KiB
C++

%{Cpp:LicenseTemplate}\
#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}"
%{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}' : ''}
@elsif %{JS: Cpp.hasQObjectParent('%{Base}')}
%{CN}::%{CN}(QObject *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}')}\