forked from qt-creator/qt-creator
"New Class" wizard: Add option for adding the Q_OBJECT macro
This lets users specify that a class derived from a custom base should have a Q_OBJECT macro, and it also allows them to opt out of it for classes derived directly from QObject & friends. Fixes: QTCREATORBUG-21810 Change-Id: I850bd3bcb7b6eb71720afe5fa097178ff5d5c620 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -28,7 +28,7 @@ class %{CN} : public %{Base}
|
||||
class %{CN}
|
||||
@endif
|
||||
{
|
||||
@if %{isQObject}
|
||||
@if '%{AddQObjectMacro}'
|
||||
Q_OBJECT
|
||||
@endif
|
||||
public:
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user