QtDesignStudio/QMLProjectFileFormat: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
# Move all modules from "./assets_imports" to "./Generated". Adjust the import URIs throughout the project. | # Move all modules from "./assets_imports" to "./Generated". Adjust the import URIs throughout the project. | ||
# Rename "./content" to "./ProjectNameContent". Adjust the import URIs throughout the project. | # Rename "./content" to "./ProjectNameContent". Adjust the import URIs throughout the project. | ||
# Look out for any `..` and `content` entries. As you have modified the directory structure and names, these need to be adapted throughout the project. | |||
# Make sure that URIs in qmldir files match the directory structure, e.g. a qmldir defined in "./Generated/QtQuick3D/DangerArrow/qmldir" should be defined as "module Generated.QtQuick3D.DangerArrow". This is needed to ensure the same URIs between QDS and generated CMakeLists files. Ensure that import in .qml files match these URIs. | # Make sure that URIs in qmldir files match the directory structure, e.g. a qmldir defined in "./Generated/QtQuick3D/DangerArrow/qmldir" should be defined as "module Generated.QtQuick3D.DangerArrow". This is needed to ensure the same URIs between QDS and generated CMakeLists files. Ensure that import in .qml files match these URIs. | ||
# Add missing filters to qmlproject. One has to make sure that all files in the subdirectories are effectively added to the project. This means that for a directory that contains QML and JavaScript files one has to define QMLFiles and JavaScriptFiles with this "directory". | # Add missing filters to qmlproject. One has to make sure that all files in the subdirectories are effectively added to the project. This means that for a directory that contains QML and JavaScript files one has to define QMLFiles and JavaScriptFiles with this "directory". | ||
Line 22: | Line 23: | ||
# Remove any CMakeLists.txt files as the export to QtCreator should be done with "File" -> "Export Project" -> "Enable CMake Generator". | # Remove any CMakeLists.txt files as the export to QtCreator should be done with "File" -> "Export Project" -> "Enable CMake Generator". | ||
# Modify the "ExamplesModel.qml" and "ExamplesModelV2.qml" inside of "examples/dataImports/DataModels/" to reflect the "qmlFileName" correctly after the changes. | # Modify the "ExamplesModel.qml" and "ExamplesModelV2.qml" inside of "examples/dataImports/DataModels/" to reflect the "qmlFileName" correctly after the changes. | ||
# If project uses shaders, please add the following snippet to the qmlproject: | # If project uses shaders, please add the following snippet to the qmlproject (please remember to change the UntitledProject3DContent/shaders/* path to the correct one) : | ||
<syntaxhighlight lang="qml"> | <syntaxhighlight lang="qml"> | ||
ShaderTool { | ShaderTool { |
Revision as of 12:57, 14 February 2025
With Qt Design Studio 4.5 the project structure did change.
With Qt Design Studio 4.5 we changed the project structure. The goal was to have only a single import path (./) at the root of the project. This is better in line with the QML compiler and QML tooling. (https://doc.qt.io/qt-6/qtqml-qtquick-compiler-tech.html). This also makes it so the relative URIs between modules are now the same in QDS and in the compiled C++ application.
Outline of changes
- Before there were usually two import `imports` and "assets_imports".
- The default project module is now in ./ProjectName instead of imports/ProjectName.
- Assets are now imported to "Generated" instead of "assets_imports".
- QtQuick3D assets are now in Generated/QtQuick3D and Generated.Effects instead of e.g. assets_imports/QtQuick3DAssets.
- Because of the different import paths the (relative) URIs of resources like meshes are not the same when running the project in Qt Design Studio and the resulting C++ application. The solution is to either avoid referencing assets (files like .mesh files) between modules or moving to the new project structure.
Adjusting the project structure for legacy projects:
One has to:
- Move the project module from "./import/ProjectName" to "./ProjectName". The same applies to any other module in imports. The URI is not affected by this.
- Move all modules from "./assets_imports" to "./Generated". Adjust the import URIs throughout the project.
- Rename "./content" to "./ProjectNameContent". Adjust the import URIs throughout the project.
- Look out for any `..` and `content` entries. As you have modified the directory structure and names, these need to be adapted throughout the project.
- Make sure that URIs in qmldir files match the directory structure, e.g. a qmldir defined in "./Generated/QtQuick3D/DangerArrow/qmldir" should be defined as "module Generated.QtQuick3D.DangerArrow". This is needed to ensure the same URIs between QDS and generated CMakeLists files. Ensure that import in .qml files match these URIs.
- Add missing filters to qmlproject. One has to make sure that all files in the subdirectories are effectively added to the project. This means that for a directory that contains QML and JavaScript files one has to define QMLFiles and JavaScriptFiles with this "directory".
- For the files not listed in https://doc.qt.io/QtForMCUs-2.9/qtul-qmlproject-reference.html please use "Files" with "filter".
- Remove any CMakeLists.txt files as the export to QtCreator should be done with "File" -> "Export Project" -> "Enable CMake Generator".
- Modify the "ExamplesModel.qml" and "ExamplesModelV2.qml" inside of "examples/dataImports/DataModels/" to reflect the "qmlFileName" correctly after the changes.
- If project uses shaders, please add the following snippet to the qmlproject (please remember to change the UntitledProject3DContent/shaders/* path to the correct one) :
ShaderTool {
args: "-s --glsl \"100 es,120,150\" --hlsl 50 --msl 12"
files: [ "UntitledProject3DContent/shaders/*" ]
}
An example of a Merge Request doing these changes is present here: https://git.qt.io/public-demos/qtdesign-studio/-/merge_requests/41
Project structure since Qt Design Studio 4.5:
ProjectName - ### Folder containing the project ProjectName ### Default QML module with the same name as the project ContentProjectName ### Folder with the main QML files. Contains the project name, so it becomes unique, since in the C++ project this is a QML module Generated ### Folder containing all generated QML modules from 3D import, content library and design systems