// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page studio-exporting-for-c.html
    \previouspage
    \nextpage

    \title Exporting a \QDS project for C++ development

        Before you export a \QDS project for Qt Creator, install the following:
        \list
            \li Qt Creator 13.0 or above.
            \li \QDS 4.5 or above.
            \li Git. To learn more about installing Git,
            see \l {https://wiki.qt.io/Git_Installation}.
        \endlist

        To export a \QDS project for Qt Creator:
        \list 1
            \li \l {Creating projects} {Create} or open a \QDS project with \QDS 4.5 or above.

                \note If you are creating a new project in \QDS, select a
                    \uicontrol {Target Qt Version} that is not higher than the Qt version
                    used in your Qt Creator.

            \li Go to \uicontrol {File} > \uicontrol {Export Project}
                > \uicontrol {Enable CMake Generator}. This creates a
                \c {CMakeLists.txt} file in your project folder.

                \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-cmake.webp {Exporting a Qt Design Studio project to CMake.}
        \endlist

    \section1 Opening the \QDS project in Qt Creator

        Open the \c {CMakeLists.txt} file in Qt Creator:

        \list 1
            \li In Qt Creator, select \uicontrol File > \uicontrol {Open File or Project}.
            \li From your project folder, select \c {CMakeLists.txt}.
                Then select \uicontrol Open.

                \image studio-project-cmake-generation.webp {Project folder after CMake generation.}

            \li Select the Qt version and then \uicontrol {Configure Project}.

                \note If your \QDS project was created with a later Qt version than the one
                    available in Qt Creator, the import doesn't work. Use
                    \l {Get and Install Qt with Qt Online Installer} {Qt Online Installer}
                    to install the latest Qt version. If successfully opened, you see all files in
                    the \uicontrol Projects view.

                \image qtcreator-qt-design-studio-project.webp {Qt Design Studio projects in Qt Creator after successful import.}

            \li To run the project, select the run dropdown from the top toolbar, and then select
                \uicontrol {Live Preview}.
        \endlist

        \note \QDS 4.4 and earlier versions have a project structure where
        different explicit import paths such as \c imports or \c 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.
*/
