diff --git a/doc/qtdesignstudio/images/studio-project-export-cmake.webp b/doc/qtdesignstudio/images/studio-project-export-cmake.webp new file mode 100644 index 00000000000..2590310bba4 Binary files /dev/null and b/doc/qtdesignstudio/images/studio-project-export-cmake.webp differ diff --git a/doc/qtdesignstudio/images/studio-project-export-python-file.webp b/doc/qtdesignstudio/images/studio-project-export-python-file.webp new file mode 100644 index 00000000000..c4db72ebb9a Binary files /dev/null and b/doc/qtdesignstudio/images/studio-project-export-python-file.webp differ diff --git a/doc/qtdesignstudio/images/studio-project-export-python-folder.webp b/doc/qtdesignstudio/images/studio-project-export-python-folder.webp new file mode 100644 index 00000000000..a465f516024 Binary files /dev/null and b/doc/qtdesignstudio/images/studio-project-export-python-folder.webp differ diff --git a/doc/qtdesignstudio/images/studio-project-export-python.webp b/doc/qtdesignstudio/images/studio-project-export-python.webp new file mode 100644 index 00000000000..647ec742634 Binary files /dev/null and b/doc/qtdesignstudio/images/studio-project-export-python.webp differ diff --git a/doc/qtdesignstudio/images/studio-project-export.webp b/doc/qtdesignstudio/images/studio-project-export.webp deleted file mode 100644 index b79ce329ee1..00000000000 Binary files a/doc/qtdesignstudio/images/studio-project-export.webp and /dev/null differ diff --git a/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc b/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc index e214b7709e3..5b59d665971 100644 --- a/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc +++ b/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc @@ -27,14 +27,19 @@ \e CMakeLists.txt file as the project file. This enables you to share your project as a fully working C++ application with developers. - To export a \QDS project for Qt Creator, you need: + You can also enable \QDS projects for Python development. When enabled, + \QDS creates a Python folder within the project folder with the file + \e {main.py}. Use this file to start the development in Python for the UI + made with \QDS. - \list - \li Qt Creator 13.0 or above. - \li \QDS 4.5 or above. - \endlist + \section1 Exporting a \QDS Project for C++ Development - \section1 Exporting a \QDS Project + To export a \QDS project for Qt Creator, you need: + + \list + \li Qt Creator 13.0 or above. + \li \QDS 4.5 or above. + \endlist \list 1 \li \l {Creating a Project} {Create} or open your \QDS project with \QDS 4.5 or above. @@ -44,14 +49,14 @@ used in your Qt Creator. \li Go to \uicontrol {File} > \uicontrol {Export Project} - > \uicontrol {Enable Automatic CMake Generation}. This creates a + > \uicontrol {Enable CMake Generator}. This creates a \e {CMakeLists.txt} file in your project folder. - \note Enabling this option tracks the changes made to the project in Qt Creator - and automatically updates in \QDS. The connection works unless you + \note Enabling this option tracks the changes made to the project in \QDS + and automatically updates in Qt Creator. The connection works unless you deactivate the option. - \image studio-project-export.webp "Exporting Qt Design Studio project" + \image studio-project-export-cmake.webp "Exporting Qt Design Studio project to CMake" \endlist \section1 Opening the \QDS Project in Qt Creator @@ -76,4 +81,81 @@ \image qtcreator-qt-design-studio-project.webp "Qt Design studio projects in Qt Creator after successful import" \li To run the project, select \uicontrol Run. \endlist + + \note \QDS 4.4 and earlier versions have a project structure where + different explicit import paths such as \e imports or \e 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 \QDS 4.5, this issue has been solved. + All the import assets are now bundled in the same folder, so the CMake + generation works properly. + + \section1 Exporting a \QDS Project for Python Development + + \list 1 + \li \l {Creating a Project} {Create} a project with \QDS 4.5 or above. + Then open your \QDS project with \QDS 4.6 or above. + + \note You cannot export a project created with \QDS 4.4 or an + earlier version of \QDS for Python development. + + \li Go to \uicontrol {File} > \uicontrol {Export Project} + > \uicontrol {Enable Python Generator}. This creates a + Python folder in your project folder. You can find the + \e {main.py} file in the Python folder. This file is + necessary for working in Python. + + \note Do not modify the contents of the \e {autogen} folder inside + the Python folder manually; they are overwritten with each + change you make in the project. + + \image studio-project-export-python.webp "Exporting Qt Design Studio project to Python" + \endlist + + \section1 Opening the \QDS Project with Python + + After your project have the Python folder and the \e {main.py} file + available, you can start setting up your Python environment for developing + with \QDS projects. + + \table + \row + \li {2,1} \image studio-project-export-python-folder.webp "The generated Python folder in the Qt Design Studio project" + \li {2,2} \image studio-project-export-python-file.webp "The generated Python file in the Qt Design Studio project" + \endtable + \list 1 + \li If you don't have Python installed on your computer, install it. + The latest version of Python is available + \l {https://www.python.org/downloads/} {here}. + + \li Next, follow the steps from this document to + \l {https://doc.qt.io/qtforpython-6/quickstart.html} {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. + + \li After installing PySide6, install \QDS packages for PySide6. Stay + in the virtual environment that was accessed for installing + PySide6. From there, execute the command in the command prompt. + \code + pip install PySide6_DS + \endcode + + \li Go to your project folder in the command prompt. + \code + cd path/to/your/project/folder + \endcode + + \li Finally, run the command below in the command prompt to open the + \e {main.py} file from your project. + \code + python Python\main.py + \endcode + \endlist + + Your \QDS project now runs in Python. Use Python to add more + functionalities to the project. Go to \l {Qt for Python} to learn more + about developing Qt projects using Python. */