diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.h b/share/qtcreator/templates/wizards/classes/cpp/file.h index 583c63dd30e..6f38dc98383 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.h +++ b/share/qtcreator/templates/wizards/classes/cpp/file.h @@ -28,7 +28,7 @@ class %{CN} : public %{Base} class %{CN} @endif { -@if %{isQObject} +@if '%{AddQObjectMacro}' Q_OBJECT @endif public: diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index 85218814836..18755802470 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -132,6 +132,17 @@ "checked": false } }, + { + "name": "AddQObjectMacro", + "trDisplayName": "Add Q_OBJECT", + "type": "CheckBox", + "data": + { + "checkedValue": "AddQObjectMacro", + "uncheckedValue": "", + "checked": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf(value('Base')) >= 0 }" + } + }, { "name": "Sp2", "type": "Spacer"