summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Morgan <david.morgan@kdab.com>2017-02-07 10:14:08 +0000
committerSean Harmer <sean.harmer@kdab.com>2017-02-07 10:44:45 +0000
commit69b94b86e3141f1204c5a1121e1d289cd6f04a7b (patch)
tree42f41de2902d4da1fbc2004afc2914e36d2e8641 /tools
parentb6d57c31f5bc97a80c7723f93b94edddccb18d1d (diff)
Add QBackendNode wizard template
Change-Id: I0cca7a6037c4c599cc953c0d5d293c77f09216a0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode.cpp20
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/backendnode_p.h35
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file.cpp6
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h2
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h2
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json18
6 files changed, 72 insertions, 11 deletions
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 <Qt3DCore/qbackendnode.h>
+
+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 <Qt3DCore/qcomponent.h>
@elsif '%{Base}' === 'QEntity'
#include <Qt3DCore/qentity.h>
-@elsif '%{Base}' === 'QBackendNode'
-#include <Qt3DCore/qbackendnode.h>
@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 <Qt3DCore/private/qcomponent_p.h>
@elsif '%{Base}' === 'QEntity'
#include <Qt3DCore/private/qentity_p.h>
-@elsif '%{Base}' === 'QBackendNode'
-#include <Qt3DCore/private/qbackendnode_p.h>
@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
}
]