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

/*!
    \page studio-designer-developer-workflow.html
    \previouspage studio-implementing-applications.html
    \nextpage studio-debugging.html

    \title 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
    \l{Customizing the Menu}.

    \QDS enables designers and developers to work together on common
    projects to develop applications. Designers use the \l{Design Views}{views}
    in the \uicontrol Design mode to modify \l{UI Files}{UI files} (\e .ui.qml),
    whereas developers use Qt Creator to work on the Qt Quick (\e .qml) and
    other files that are needed to implement the application logic and to
    prepare the application for production.

    Use the \l{Using Git}{Git} version control system to ensure that changes
    are not lost when files are passed back and forth between designers and
    developers.

    \QDS \l{Creating Projects}{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.

    \QDS continues to use the \e .qmlproject file format, while Qt Creator uses a
    \e CMakeLists.txt file as the project file. This enables you to share
    your project as a fully working C++ application with developers.

    If you use Git, you can clone an example project
    \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/master/playground/AuroraCluster0}
    {here}.

    \section1 Exporting a \QDS Project

    \QDS uses a different project format than Qt Creator. \QDS does not build the project,
    it uses a pre-compiled \l{QML runtime} to run the project. To export a \QDS project for the
    Qt Creator, follow the process:

    \list 1
        \li Open the project you want to export in \QDS.
        \li Select \uicontrol {File} > \uicontrol {Export Project} > \uicontrol {Generate CMake Build Files}.
            \image studio-project-export.webp "Export the \QDS project for Qt Creator"

        \li Select \uicontrol {Details} to access the \l {Advanced Options}.
            \image studio-project-export-advanced.webp "Access Advanced Options in the project exporter"

            \note The project exporter has default settings selected. This works better if the project
             is combined with an existing Qt project.

        \li Select all the options here. This allows to export the
            complete project. So, it can be compiled as a stand-alone application.
            \image studio-project-export-advanced-options.webp "Select all the options in the project exporter"

            \note If you copy this export on top of the existing Qt Creator project
                  it overwrites the existing project. Hence, the default selected options in
                  the exporter only exports the QML-specific items. You get a list of
                  warnings at the bottom part of the exporter that denotes exactly which parts
                  of the project gets overwritten.
    \endlist

    \section1 Using the Exported Project in Qt Creator

    After exporting the project from the \QDS, you have to open it from Qt Creator.

    If you have used any version before \QDS 4.0 to create the project, manually include this code
    in the \l {CMakeLists.txt} file so the exported project works in Qt Creator.

    \code
        set(BUILD_QDS_COMPONENTS ON CACHE BOOL "Build design studio components")

        set(CMAKE_INCLUDE_CURRENT_DIR ON)

        if (${BUILD_QDS_COMPONENTS})
            include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents)
        endif ()

        include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules)
    \endcode

    \note If you have created the project with the \QDS version 4.0 or above, you already have this code in
          \l {CMakeLists.txt} by default.

*/
