From 6c0f2b1c6344a894dabf3532ceb5486ec9deca83 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Mon, 20 Sep 2021 15:44:51 -0400 Subject: [PATCH] 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 Reviewed-by: Alessandro Portale --- .../qtcreator/templates/wizards/classes/cpp/file.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.cpp b/share/qtcreator/templates/wizards/classes/cpp/file.cpp index 1676ef0e7f8..8ebbf1d26b4 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.cpp +++ b/share/qtcreator/templates/wizards/classes/cpp/file.cpp @@ -10,11 +10,14 @@ public: @endif @if '%{Base}' === 'QObject' -%{CN}::%{CN}(QObject *parent) : QObject(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''} +%{CN}::%{CN}(QObject *parent) + : QObject{parent}%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''} @elsif '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow' -%{CN}::%{CN}(QWidget *parent) : %{Base}(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''} +%{CN}::%{CN}(QWidget *parent) + : %{Base}{parent}%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''} @elsif %{JS: Cpp.hasQObjectParent('%{Base}')} -%{CN}::%{CN}(QObject *parent) : %{Base}(parent)%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''} +%{CN}::%{CN}(QObject *parent) + : %{Base}{parent}%{JS: ('%{SharedDataInit}') ? ', %{SharedDataInit}' : ''} @else %{CN}::%{CN}()%{JS: ('%{SharedDataInit}') ? ' : %{SharedDataInit}' : ''} @endif @@ -23,7 +26,8 @@ public: } @if '%{IncludeQSharedData}' -%{CN}::%{CN}(const %{CN} &rhs) : data(rhs.data) +%{CN}::%{CN}(const %{CN} &rhs) + : data{rhs.data} { }