From d6065db9839368f23486040b26350c5753aa29bb Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 25 Apr 2024 15:15:58 +0200 Subject: [PATCH] QmlDesigner: Fix JavaScript wizard The old wizard syntax stopped working. Using QML file wizard as template. Task-number: QDS-12520 Change-Id: Ib188f898c28be8b7ad9284f431ef0526fbc7bf7e Reviewed-by: Tim Jenssen Reviewed-by: Qt CI Patch Build Bot --- .../files/javascript/wizard.json | 50 +++++++++++++++---- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/share/qtcreator/qmldesigner/studio_templates/files/javascript/wizard.json b/share/qtcreator/qmldesigner/studio_templates/files/javascript/wizard.json index 7ba90f75f6f..f70ed11c1da 100644 --- a/share/qtcreator/qmldesigner/studio_templates/files/javascript/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/files/javascript/wizard.json @@ -9,13 +9,46 @@ "icon": "file_javascript.png", "platformIndependent": true, + "options": + [ + { "key": "JSFile", "value": "%{Class}.%{JS: Util.preferredSuffix('application/javascript')}" }, + { "key": "ApplicationImport", "value": "%{QmlProjectName} 1.0" }, + { "key": "RootItem", "value": "%{JS: %{RootItemCB}.RootItem}" }, + { "key": "UseImportDefault", "value": "%{JS: false}" }, + { "key": "UseQtQuickControls2Default", "value": "%{JS: true}" } + ], "pages" : - [ + [ { - "trDisplayName": "Location", - "trShortTitle": "Location", - "typeId": "File" + "trDisplayName": "Define Class", + "trShortTitle": "Details", + "typeId": "Fields", + "data" : + [ + { + "name": "Class", + "trDisplayName": "Component name:", + "mandatory": true, + "type": "LineEdit", + "data": { + "validator": "(?:[A-Z_][a-zA-Z_0-9]*|)", + "fixup": "%{JS: '%{INPUT}'.charAt(0).toUpperCase() + '%{INPUT}'.slice(1) }" + } + }, + { + "name": "TargetPath", + "type": "PathChooser", + "trDisplayName": "Path:", + "mandatory": true, + "data": + { + "kind": "existingDirectory", + "basePath": "%{InitialPath}", + "path": "%{InitialPath}" + } + } + ] }, { "trDisplayName": "Options", @@ -34,21 +67,16 @@ } } ] - }, - { - "trDisplayName": "Project Management", - "trShortTitle": "Summary", - "typeId": "Summary" } ], "generators" : - [ + [ { "typeId": "File", "data": { "source": "file.js.tpl", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/javascript')}')}", + "target": "%{TargetPath}/%{JSFile}", "openInEditor": true } }