diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.h b/share/qtcreator/templates/wizards/classes/cpp/file.h index df35bd553c2..77f1b213516 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.h +++ b/share/qtcreator/templates/wizards/classes/cpp/file.h @@ -32,6 +32,9 @@ class %{CN} @if '%{AddQObjectMacro}' Q_OBJECT @endif +@if '%{AddQmlElementMacro}' + QML_ELEMENT +@endif public: @if '%{Base}' === 'QObject' || %{JS: Cpp.hasQObjectParent('%{Base}')} explicit %{CN}(QObject *parent = nullptr); diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index 33ba82355a9..9317c175981 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -146,6 +146,17 @@ "checked": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf(value('Base')) >= 0 }" } }, + { + "name": "AddQmlElementMacro", + "trDisplayName": "Add QML_ELEMENT", + "type": "CheckBox", + "data": + { + "checkedValue": "AddQmlElementMacro", + "uncheckedValue": "", + "checked": "%{JS: ['QQuickItem'].indexOf(value('Base')) >= 0 }" + } + }, { "name": "Sp2", "type": "Spacer"