diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2024-01-30 16:38:08 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2024-02-01 09:02:01 +0000 |
commit | 347c6b11211127bd9c7db94755d9401cc2f5ba32 (patch) | |
tree | db288b8ef815bc7e03f4cddfe52d08f2b3c1915a | |
parent | a4d83484324d905a9c89ad08c2749b30df9776db (diff) |
QmlDesigner: Add extended 3D project template
Extended 3D template use ExtendedSceneEnvironment instead of regular
SceneEnvironment to enable various built-in effects.
Fixes: QDS-11812
Change-Id: If84807f5a4dd327d6da4f08669b66ed3d7a1ff14
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
6 files changed, 503 insertions, 0 deletions
diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/Screen01.ui.qml.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/Screen01.ui.qml.tpl new file mode 100644 index 0000000000..2b26fe3f0c --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/Screen01.ui.qml.tpl @@ -0,0 +1,70 @@ +/* +This is a UI file (.ui.qml) that is intended to be edited in Qt Design Studio only. +It is supposed to be strictly declarative and only uses a subset of QML. If you edit +this file manually, you might introduce QML code that is not supported by Qt Design Studio. +Check out https://doc.qt.io/qtcreator/creator-quick-ui-forms.html for details on .ui.qml files. +*/ + +import QtQuick %{QtQuickVersion} +import QtQuick.Controls %{QtQuickVersion} +import QtQuick3D %{QtQuick3DVersion} +import QtQuick3D.Effects %{QtQuick3DVersion} +import QtQuick3D.Helpers %{QtQuick3DVersion} +import %{ImportModuleName} %{ImportModuleVersion} + +Rectangle { + width: Constants.width + height: Constants.height + + color: Constants.backgroundColor + + View3D { + id: view3D + anchors.fill: parent + + environment: sceneEnvironment + + ExtendedSceneEnvironment { + id: sceneEnvironment + antialiasingMode: SceneEnvironment.MSAA + antialiasingQuality: SceneEnvironment.High + } + + Node { + id: scene + DirectionalLight { + id: directionalLight + } + + PerspectiveCamera { + id: sceneCamera + z: 350 + } + + Model { + id: cubeModel + eulerRotation.y: 45 + eulerRotation.x: 30 + materials: defaultMaterial + source: "#Cube" + } + } + } + + Item { + id: __materialLibrary__ + PrincipledMaterial { + id: defaultMaterial + objectName: "Default Material" + baseColor: "#4aee45" + } + } + + Text { + text: qsTr("Hello %{ProjectName}") + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: 100 + font.family: Constants.font.family + } +} diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/contentmodule.main.qml.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/contentmodule.main.qml.tpl new file mode 100644 index 0000000000..96f5dbaa36 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/contentmodule.main.qml.tpl @@ -0,0 +1,36 @@ +import QtQuick %{QtQuickVersion} +@if !%{IsQt6Project} +import QtQuick.Window %{QtQuickVersion} +@endif +import %{ApplicationImport} +@if %{UseVirtualKeyboard} +import QtQuick.VirtualKeyboard %{QtQuickVersion} +@endif + +Window { + width: Constants.width + height: Constants.height + + visible: true + + Screen01 { + } + +@if %{UseVirtualKeyboard} + InputPanel { + id: inputPanel + property bool showKeyboard : active + y: showKeyboard ? parent.height - height : parent.height + Behavior on y { + NumberAnimation { + duration: 200 + easing.type: Easing.InOutQuad + } + } + anchors.leftMargin: Constants.width/10 + anchors.rightMargin: Constants.width/10 + anchors.left: parent.left + anchors.right: parent.right + } +@endif +} diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/desktop_blank.png b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/desktop_blank.png Binary files differnew file mode 100644 index 0000000000..7cf79d6d02 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/desktop_blank.png diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/desktop_blank@2.png b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/desktop_blank@2.png Binary files differnew file mode 100644 index 0000000000..3dc3dde8f4 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/desktop_blank@2.png diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/detailsPage.qml b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/detailsPage.qml new file mode 100644 index 0000000000..224b9b1736 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/detailsPage.qml @@ -0,0 +1,8 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import ProjectType + +DefaultProject { + +} diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/wizard.json new file mode 100644 index 0000000000..0e3e699a01 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-extended-3d/wizard.json @@ -0,0 +1,389 @@ +{ + "version": 1, + "supportedProjectTypes": [ "QmlProjectManager.QmlProject" ], + "id": "QA.QtStudioUi3DExt", + "category": "B.StudioProject", + "trDescription": "Creates a project that uses default and 3D components, such as camera, light, model, and materials. Extended scene environment will also be included to enable various built-in effects.", + "trDisplayName": "3D Extended", + "trDisplayCategory": "General", + "icon": "desktop_blank.png", + "fontIconName": "wizardsGeneric", + "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}", + "platformIndependent": true, + + "options": + [ + { "key": "ProjectExecutableName", "value": "%{ProjectName}App" }, + { "key": "ProjectPluginName", "value": "%{ProjectName}plugin" }, + { "key": "ProjectPluginClassName", "value": "%{ProjectName}Plugin" }, + { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName('%{ProjectName}', 'qmlproject')}" }, + { "key": "IsQt6Project", "value": "%{JS: value('QtQuickVersion') !== '2.15' }" }, + { "key": "ImportModuleName", "value": "%{ProjectName}" }, + { "key": "UIClassName", "value": "Screen01" }, + { "key": "UIClassFileName", "value": "%{JS: Util.fileName('%{UIClassName}', 'ui.qml')}" }, + { "key": "QtQuickVersion", "value": "%{JS: %{TargetQtVersion}.TargetQuickVersion}" }, + { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, + { "key": "QtQuickControlsStyle", "value": "Basic" }, + { "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" }, + { "key": "ApplicationImport", "value": "%{JS: value('IsQt6Project') === 'true' ? '%{ImportModuleName}' : '%{ImportModuleName} 1.0'}" }, + { "key": "UseStandardResolution", "value": "%{JS: value('CustomScreenWidth') === '' || value('CustomScreenHeight') === ''}" }, + { "key": "ScreenWidth", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenWidth : value('CustomScreenWidth')}" }, + { "key": "ScreenHeight", "value": "%{JS: value('UseStandardResolution') === 'true' ? %{ScreenFactor}.ScreenHeight : value('CustomScreenHeight')}" }, + { "key": "UseVirtualKeyboardDefault", "value": "%{JS: false}" }, + { "key": "QtQuick3DVersion", "value": "%{JS: %{TargetQtVersion}.TargetQuick3DVersion}" }, + { "key": "ImportModuleVersion", "value": "%{JS: value('IsQt6Project') === 'true' ? '' : '1.0'}" } + ], + + "pages": + [ + { + "defaultValues": "qmlapplication-project-page" + }, + { + "trDisplayName": "Define Project Details", + "trShortTitle": "Details", + "typeId": "Fields", + "data": + [ + { + "name": "ScreenFactor", + "trDisplayName": "Screen Resolution:", + "type": "ComboBox", + "enabled": "%{JS: value('UseStandardResolution')}", + "data": + { + "index": 2, + "items": + [ + { + "trKey": "2960 x 1440", + "value": + "({ + 'ScreenWidth': '2960', + 'ScreenHeight': '1440' + })" + }, + { + "trKey": "2560 x 1440", + "value": + "({ + 'ScreenWidth': '2560', + 'ScreenHeight': '1440' + })" + }, + { + "trKey": "1920 x 1080", + "value": + "({ + 'ScreenWidth': '1920', + 'ScreenHeight': '1080' + })" + }, + { + "trKey": "1334 x 750", + "value": + "({ + 'ScreenWidth': '1334', + 'ScreenHeight': '750' + })" + }, + { + "trKey": "1280 x 960", + "value": + "({ + 'ScreenWidth': '1280', + 'ScreenHeight': '960' + })" + }, + { + "trKey": "1280 x 720", + "value": + "({ + 'ScreenWidth': '1280', + 'ScreenHeight': '720' + })" + }, + { + "trKey": "1024 x 768", + "value": + "({ + 'ScreenWidth': '1024', + 'ScreenHeight': '768' + })" + }, + { + "trKey": "640 x 480", + "value": + "({ + 'ScreenWidth': '640', + 'ScreenHeight': '480' + })" + } + ] + } + }, + { + "name": "ControlsStyle", + "trDisplayName": "Qt Quick Controls Style:", + "type": "ComboBox", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "Basic", + "value": + "({ + 'QtQuickControlsStyle': 'Basic', + 'QtQuickControlsStyleTheme': '' + })" + }, + { + "trKey": "Material Light", + "value": + "({ + 'QtQuickControlsStyle': 'Material', + 'QtQuickControlsStyleTheme': 'Light' + })" + }, + { + "trKey": "Material Dark", + "value": + "({ + 'QtQuickControlsStyle': 'Material', + 'QtQuickControlsStyleTheme': 'Dark' + })" + }, + { + "trKey": "Universal Light", + "value": + "({ + 'QtQuickControlsStyle': 'Universal', + 'QtQuickControlsStyleTheme': 'Light' + })" + }, + { + "trKey": "Universal Dark", + "value": + "({ + 'QtQuickControlsStyle': 'Universal', + 'QtQuickControlsStyleTheme': 'Dark' + })" + }, + { + "trKey": "Universal System", + "value": + "({ + 'QtQuickControlsStyle': 'Universal', + 'QtQuickControlsStyleTheme': 'System' + })" + }, + { + "trKey": "Fusion", + "value": + "({ + 'QtQuickControlsStyle': 'Fusion', + 'QtQuickControlsStyleTheme': '' + })" + }, + { + "trKey": "Imagine", + "value": + "({ + 'QtQuickControlsStyle': 'Imagine', + 'QtQuickControlsStyleTheme': '' + })" + } + ] + } + }, + { + "name": "UseVirtualKeyboard", + "trDisplayName": "Use Qt Virtual Keyboard", + "type": "CheckBox", + "data": + { + "checked": "%{UseVirtualKeyboardDefault}" + } + }, + { + "name": "CustomScreenWidth", + "trDisplayName": "Custom screen width:", + "mandatory": false, + "type": "LineEdit", + "data": + { + "validator": "^[0-9]*$", + "trText": "" + } + }, + { + "name": "CustomScreenHeight", + "trDisplayName": "Custom screen height:", + "mandatory": false, + "type": "LineEdit", + "data": + { + "validator": "^[0-9]*$", + "trText": "" + } + }, + { + "name": "TargetQtVersion", + "trDisplayName": "Target Qt Version:", + "mandatory": true, + "type": "ComboBox", + "data": + { + "index": 3, + "items": + [ + { + "trKey": "Qt 6.2", + "value": + "({ + 'TargetQuickVersion': '6.2', + 'TargetQuick3DVersion': '6.2' + })" + }, + { + "trKey": "Qt 6.3", + "value": + "({ + 'TargetQuickVersion': '6.3', + 'TargetQuick3DVersion': '6.3' + })" + }, + { + "trKey": "Qt 6.4", + "value": + "({ + 'TargetQuickVersion': '6.4', + 'TargetQuick3DVersion': '6.4' + })" + }, + { + "trKey": "Qt 6.5", + "value": + "({ + 'TargetQuickVersion': '6.5', + 'TargetQuick3DVersion': '6.5' + })" + } + ] + } + } + ] + } + + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "../common/app.qmlproject.tpl", + "target": "%{ProjectDirectory}/%{QmlProjectFileName}", + "openAsProject": true + }, + { + "source": "../common/CMakeLists.main.txt.tpl", + "target": "%{ProjectDirectory}/CMakeLists.txt" + }, + { + "source": "../common/qmlmodules.tpl", + "target": "%{ProjectDirectory}/qmlmodules" + }, + { + "source": "../common/qmlcomponents.tpl", + "target": "%{ProjectDirectory}/qmlcomponents" + }, + { + "source": "../common/insight.tpl", + "target": "%{ProjectDirectory}/insight" + }, + { + "source": "../common/main.qml", + "target": "%{ProjectDirectory}/main.qml" + }, + { + "source": "../common/qtquickcontrols2.conf.tpl", + "target": "%{ProjectDirectory}/qtquickcontrols2.conf" + }, + { + "source": "../common/main.cpp.tpl", + "target": "%{ProjectDirectory}/src/main.cpp" + }, + { + "source": "../common/app_environment.h.tpl", + "target": "%{ProjectDirectory}/src/app_environment.h" + }, + { + "source": "../common/import_qml_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_plugins.h" + }, + { + "source": "../common/import_qml_components_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_components_plugins.h" + }, + + { + "source": "../common/CMakeLists.content.txt.tpl", + "target": "%{ProjectDirectory}/content/CMakeLists.txt" + }, + { + "source": "../common/App.qml.tpl", + "target": "%{ProjectDirectory}/content/App.qml" + }, + { + "source": "Screen01.ui.qml.tpl", + "target": "%{ProjectDirectory}/content/Screen01.ui.qml", + "openInEditor": true + }, + { + "source": "../common/fonts.txt", + "target": "%{ProjectDirectory}/content/fonts/fonts.txt" + }, + { + "source": "../common/asset_imports.txt", + "target": "%{ProjectDirectory}/asset_imports/asset_imports.txt" + }, + { + "source": "../common/CMakeLists.imports.txt.tpl", + "target": "%{ProjectDirectory}/imports/CMakeLists.txt" + }, + { + "source": "../shared-plugin/name/CMakeLists.importmodule.txt.tpl", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/CMakeLists.txt" + }, + { + "source": "../shared-plugin/name/importmodule.qmldir.tpl", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/qmldir" + }, + { + "source": "../shared-plugin/name/Constants.qml.tpl", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/Constants.qml" + }, + { + "source": "../shared-plugin/name/DirectoryFontLoader.qml.tpl", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DirectoryFontLoader.qml" + }, + { + "source": "../shared-plugin/name/EventListModel.qml.tpl", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/EventListModel.qml" + }, + { + "source": "../shared-plugin/name/EventListSimulator.qml.tpl", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/EventListSimulator.qml" + }, + { + "source": "../shared-plugin/name/designer/plugin.metainfo", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" + } + ] + } + ] +} |