Designer-Developer Workflow
Note: In this section, you are using advanced menu items. These are not visible by default. To toggle the visibility of advanced menu items, see Customizing the Menu Bar.
Qt Design Studio enables designers and developers to work together on common projects to develop applications. Designers use the views in the Design mode to modify UI files (.ui.qml), whereas developers use Qt Creator to work on the Qt Quick (.qml) and other files that are needed to implement the application logic and to prepare the application for production.
Qt Design Studio projects come with boilerplate code for a working Qt 6 application that you can build and run in Qt Creator using CMake. Therefore, you can open, build, and run the projects with Qt Creator.
Qt Design Studio continues to use the .qmlproject file format, while Qt Creator uses a CMakeLists.txt file as the project file. This enables you to share your project as a fully working C++ application with developers.
You can also enable Qt Design Studio projects for Python development. When enabled, Qt Design Studio creates a Python folder within the project folder with the file main.py. Use this file to start the development in Python for the UI made with Qt Design Studio.
Exporting a Qt Design Studio Project for C++ Development
Before you export a Qt Design Studio project for Qt Creator, install the following:
- Qt Creator 13.0 or above
- Qt Design Studio 4.5 or above
- Git. Learn more about getting Git here
To export a Qt Design Studio project for Qt Creator:
- Create or open your Qt Design Studio project with Qt Design Studio 4.5 or above.
Note: If you are creating a new project in Qt Design Studio, select the Target Qt Version that is not higher than the Qt version used in your Qt Creator.
- Go to File > Export Project > Enable CMake Generator. This creates a CMakeLists.txt file in your project folder.
Note: Enabling this option tracks the changes made to the project in Qt Design Studio and automatically updates in Qt Creator. The connection works unless you deactivate the option.
Opening the Qt Design Studio Project in Qt Creator
Open the CMakeLists.txt file in Qt Creator. To open:
- In Qt Creator, select File > Open File or Project.
- Browse through your project directory and select the CMakeLists.txt. Then select Open.
- Select the Qt version and then Configure Project.
Note: If your Qt Design Studio project was created with a more updated Qt than the one available in Qt Creator, the import doesn't work. Use Qt Online Installer to install the latest Qt version. If successfully opened, all the files are accessible in the Projects view.
- To run the project, select Run.
Note: Qt Design Studio 4.4 and earlier versions have a project structure where different explicit import paths such as imports or asset_imports reference assets such as images or mesh files separately in their own scope. So, linking them from one module to another does not work in the generated CMake-based C++ application. Such cross-modular references are not considered good practice. Since Qt Design Studio 4.5, this issue has been solved. All the import assets are now bundled in the same folder, so the CMake generation works properly.
CMake Generator
FAQ
Learn how the CMake generator works.
What does the CMake Generator convert?
The CMake Generator converts the contents of the .qmlproject file to CMake.
Note: A Qt Design Studio project can run with a missing path or file filter. However, CMake generation can fail due to missing elements in the .qmlproject file.
Which changes are tracked by the CMake Generator?
All the files that are listed in .qmlproject are tracked by the CMake Generator. Editing the .qmlproject file triggers a CMake generation. Adding, removing, and renaming files are tracked.
Why do you need Stubb or Mock QML data for Qt Design Studio?
Qt Design Studio doesn't understand C++ code, so the CMake Generator ignores any components or properties made with C++. If you want a similar representation in Qt Design Studio for the components or properties created with C++, add a QML mock file for Qt Design Studio. Keep these mock files in a dedicated folder within your project folder. You can later add a mockImports
variable within the .qmlproject file and include the folder path with mock files in the mockImports
variable. CMake ignores all folders and files included in the mockImports
variable. So they only stay in the Qt Design Studio space and are not converted with CMake Generator.
Example:
mockImports: [ "MockDatas" ]
Here, MockDatas is a folder in your project folder with all the files with QML mock data. If you include this code in the .qmlproject file, the CMake Generator ignores everything inside the MockDatas folder.
Is it possible to manually change the contents of the CMakeLists.txt files?
Yes, you can make changes to the CMakeLists.txt files existing in the App and the Root folders of your project. The CMakeLists.txt files in other folders of your project are overwritten as soon as the CMake generator runs next time. Only the CMakeLists.txt files in the App and the Root folders of your project are not overwritten.
Exporting a Qt Design Studio Project for Python Development
- Create a project with Qt Design Studio 4.5 or above. Then open your Qt Design Studio project with Qt Design Studio 4.6 or above.
Note: You cannot export a project created with Qt Design Studio 4.4 or an earlier version of Qt Design Studio for Python development.
- Go to File > Export Project > Enable Python Generator. This creates a Python folder in your project folder. You can find the main.py file in the Python folder. This file is necessary for working in Python.
Note: Do not modify the contents of the autogen folder inside the Python folder manually; they are overwritten with each change you make in the project.
Opening the Qt Design Studio Project with Python
After your project have the Python folder and the main.py file available, you can start setting up your Python environment for developing with Qt Design Studio projects.
- If you don't have Python installed on your computer, install it. The latest version of Python is available here.
- Next, follow the steps from this document to install PySide6. You need this for working with Qt in Python.
Note: You need Python version between 3.8 and 3.13 to install PySide6.
- After installing PySide6, install Qt Design Studio packages for PySide6. Stay in the virtual environment that was accessed for installing PySide6. From there, execute the command in the command prompt.
pip install PySide6_DS
- Go to your project folder in the command prompt.
cd path/to/your/project/folder
- Finally, run the command below in the command prompt to open the main.py file from your project.
python Python\main.py
Your Qt Design Studio project now runs in Python. Use Python to add more functionalities to the project. Go to Qt for Python to learn more about developing Qt projects using Python.
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. Also, you can use Qt Creator to create a Qt Quick Application project that you can open in Qt Design Studio.
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 Designer 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 Designer 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.