Converting Qt Design Studio projects to applications
Qt Design Studio projects are useful for creating user interfaces. To use them for application development in Qt Creator you have to add:
- A project configuration file (CMakeLists.txt or a .pro file)
- C++ code (.cpp)
- Resource files
- Code needed for deploying applications to devices
For more information about integrating QML and C++, see Overview - QML and C++ Integration.
Note: Since Qt Design Studio 2.3.0, Qt Design Studio project wizard templates generate projects that can be built with CMake. You can open the CMakeLists.txt project file in Qt Creator to continue developing the project.
Note: Since Qt Design Studio 3.9.0, Qt Design Studio project wizard templates generate projects that automatically check out and build the Qt Quick Studio Components from Qt Code Review, using CMake. To turn off this feature, use the option BUILD_QDS_COMPONENTS in the CMake configuration.
To use qmake as the build system, use a Qt Creator wizard template to create a Qt Quick application that is built using the qmake build system and then copy the source files from the Qt UI Quick project to the application project.
You can use the RESOURCES
option in the project configuration file to automatically add all the QML files and related assets to a Qt resource collection file (.qrc). However, large files should be included as external binary resources instead of compiling them into the binary.
The wizard automatically adds the QML_IMPORT_PATH
option to the project file for specifying the required QML import path. The path is only needed if more than one subdirectory has QML files.
Then you can use the QQuickView class in the main C++ source file to show the main QML file when the application starts.
If you only install Qt Creator and Qt, remember to also select the Qt Quick Timeline module for installation.
Handling Large Data Files
Graphical assets used in the UI, such as images, effects, or 3D scenes are a typical cause for performance problems in UIs. Even building the application requires huge amounts of memory if you try to include large asset files, such as 100-MB 3D models or 64-MB textures, into the .qrc
file for compiling them into the binary.
First try to optimize your assets, as described in Optimizing designs and Creating optimized 3D scenes.
Large assets should either be loaded directly from the file system or by using the Qt resource system dynamically. For more information, see The Qt Resource System.
Adding Qt Quick Studio Components to Qt Installations
Since Qt Design Studio 3.9, the Qt Quick Studio Components module is installed by default as part of the application created with Qt Design Studio. You can also install the module manually.
For example:
- Clone the module repository.
git clone https://code.qt.io/qt-labs/qtquickdesigner-components.git
- Install the Qt Quick Studio Components module.
mkdir build cd build cmake -GNinja -DCMAKE_INSTALL_PREFIX=<path_to_qt_install_directory> <path_to_qtquickdesigner-components> cmake --build . cmake --install .
Note: Here, <path_to_qt_install_directory> and <path_to_qtquickdesigner-components> needs to be replaced with the real location on your local drive. For example, <path_to_qt_install_directory> can be something like /Qt/6.3.0/msvc2019_64 and <path_to_qtquickdesigner-components> like this ../qtquickdesigner-components/
Available under certain Qt licenses.
Find out more.