From 69b94b86e3141f1204c5a1121e1d289cd6f04a7b Mon Sep 17 00:00:00 2001 From: David Morgan Date: Tue, 7 Feb 2017 10:14:08 +0000 Subject: Add QBackendNode wizard template Change-Id: I0cca7a6037c4c599cc953c0d5d293c77f09216a0 Reviewed-by: Sean Harmer --- .../templates/wizards/classes/qt3d/backendnode.cpp | 20 +++++++++++++ .../templates/wizards/classes/qt3d/backendnode_p.h | 35 ++++++++++++++++++++++ .../templates/wizards/classes/qt3d/file.cpp | 6 ---- .../templates/wizards/classes/qt3d/file.h | 2 -- .../templates/wizards/classes/qt3d/file_p.h | 2 -- .../templates/wizards/classes/qt3d/wizard.json | 18 ++++++++++- 6 files changed, 72 insertions(+), 11 deletions(-) create mode 100644 tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp create mode 100644 tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h (limited to 'tools') diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp new file mode 100644 index 000000000..46f711849 --- /dev/null +++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp @@ -0,0 +1,20 @@ +%{Cpp:LicenseTemplate}\ +#include "%{PrivateHdrFileName}" + +QT_BEGIN_NAMESPACE +%{JS: Cpp.openNamespaces('%{Class}')} +%{CN}::%{CN}() +{ +} + +void %{CN}::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) +{ +} + +void %{CN}::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) +{ +} + +%{JS: Cpp.closeNamespaces('%{Class}')}\ + +QT_END_NAMESPACE diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h new file mode 100644 index 000000000..12ee68155 --- /dev/null +++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h @@ -0,0 +1,35 @@ +%{Cpp:LicenseTemplate}\ + +#ifndef %{GUARD} +#define %{GUARD} + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include + +QT_BEGIN_NAMESPACE +%{JS: Cpp.openNamespaces('%{Class}')} +class %{CN} : public Qt3DCore::%{Base} +{ +public: + %{CN}(); + + void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE; + +private: + void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL; +}; +%{JS: Cpp.closeNamespaces('%{Class}')} + +QT_END_NAMESPACE + +#endif // %{GUARD}\ diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp index 4200859a9..5106a9e74 100644 --- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp +++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp @@ -4,7 +4,6 @@ QT_BEGIN_NAMESPACE %{JS: Cpp.openNamespaces('%{Class}')} -@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity' %{CN}Private::%{CN}Private() : Qt3DCore::%{Base}Private() { @@ -23,11 +22,7 @@ QT_BEGIN_NAMESPACE %{CN}::~%{CN}() { } -@else -// TODO: Implement QBackendNode template -@endif -@if '%{Base}' === 'QNode' || '%{Base}' === 'QComponent' || '%{Base}' === 'QEntity' Qt3DCore::QNodeCreatedChangeBasePtr %{CN}::createNodeCreationChange() const { auto creationChange = Qt3DCore::QNodeCreatedChangePtr<%{CN}Data>::create(this); @@ -36,7 +31,6 @@ Qt3DCore::QNodeCreatedChangeBasePtr %{CN}::createNodeCreationChange() const // TODO: Send data members in creation change return creationChange; } -@endif %{JS: Cpp.closeNamespaces('%{Class}')}\ QT_END_NAMESPACE diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h index 9060461eb..c4162d647 100644 --- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h +++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h @@ -9,8 +9,6 @@ #include @elsif '%{Base}' === 'QEntity' #include -@elsif '%{Base}' === 'QBackendNode' -#include @endif QT_BEGIN_NAMESPACE diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h index 9de21e805..d1acea35e 100644 --- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h +++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h @@ -20,8 +20,6 @@ #include @elsif '%{Base}' === 'QEntity' #include -@elsif '%{Base}' === 'QBackendNode' -#include @endif QT_BEGIN_NAMESPACE diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json index c9fe63685..8079aa4b4 100644 --- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json +++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json @@ -73,7 +73,8 @@ "name": "HdrFileName", "type": "LineEdit", "trDisplayName": "Header file:", - "mandatory": true, + "mandatory": false, + "enabled": "%{JS: '%{BaseCB}' !== 'QBackendNode'}", "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } }, { @@ -120,16 +121,31 @@ { "source": "file.h", "target": "%{HdrPath}", + "condition": "%{JS: '%{Base}' !== 'QBackendNode'}", "openInEditor": true }, { "source": "file_p.h", "target": "%{PrivateHdrPath}", + "condition": "%{JS: '%{Base}' !== 'QBackendNode'}", "openInEditor": true }, { "source": "file.cpp", "target": "%{SrcPath}", + "condition": "%{JS: '%{Base}' !== 'QBackendNode'}", + "openInEditor": true + }, + { + "source": "backendnode.cpp", + "target": "%{SrcPath}", + "condition": "%{JS: '%{Base}' === 'QBackendNode'}", + "openInEditor": true + }, + { + "source": "backendnode_p.h", + "target": "%{PrivateHdrPath}", + "condition": "%{JS: '%{Base}' === 'QBackendNode'}", "openInEditor": true } ] -- cgit v1.2.3