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

/*!
    \page studio-projects.html
    \previouspage creator-keyboard-shortcuts.html
    \nextpage studio-use-cases.html

    \title Creating Projects

    One of the major advantages of \QDS is that it allows a team of designers
    and developers to share a project across different development platforms
    with a common tool for design, development, profiling, and debugging.

    Creating a project enables you to:

    \list
        \li Group files together.
        \li Include \l{UI Files}{UI files} (.ui.qml), component files (.qml),
            and assets files.
        \li Specify settings for previewing UIs.
    \endlist

    Setting up a new project in \QDS is aided by a wizard with a set of
    presets that you can choose from. You can adjust project settings and save
    custom presets. When you create a project, all necessary files are created.

    The following presets are available:

    \table
    \header
        \li Category
        \li Preset
        \li Purpose
    \row
        \li Recents
        \li
        \li Lists your most recently used presets.
    \row
        \li {1,2} General
        \li Empty
        \li Creates a project that uses default components such as rectangles,
            images, and text. You can run the application on all target
            platforms.
    \row
        \li 3D
        \li Creates a project that uses default and 3D components such as
            cameras, lights, 3D models, and materials.
    \row
        \li Qt for MCUs
        \li MCU
        \li Creates an application that uses a subset of default components
            (as supported by Qt for MCUs) that you can deploy, run, and debug
            on MCU boards.
    \row
        \li {1,3} Mobile
        \li Scroll
        \li Creates an application that uses Qt Quick controls to implement a
            scrollable list.
    \row
        \li Stack
        \li Creates an application that uses Qt Quick controls to implement a
            set of pages with a stack-based navigation model.
    \row
        \li Swipe
        \li Creates an application that uses Qt Quick controls to implement a
            swipable screen.
    \row
        \li Desktop
        \li Launcher
        \li Creates a project that uses default components such as rectangles,
            images, and text, and defines a launcher application.
   \row
        \li Custom
        \li
        \li Lists your saved custom presets.
            \note This tab is not visible if there are no saved custom presets.
    \endtable

    \image studio-project-wizards.png "The Create Project wizard"

    To test how well your designs work, you can preview the
    UIs on the desktop, embedded Linux devices, or Android devices. For more
    information, see \l{Validating with Target Hardware}.

    You can export designs from other design tools and import them to projects.
    For more information, see \l{Exporting from Design Tools} and
    \l{Importing Designs From Other Design Tools}.

    \section1 Creating a Project

    To create a project:

    \list 1
        \li Select \uicontrol File > \uicontrol {New Project}.
        \li In the \uicontrol Presets tab, select a preset.
        \li In the \uicontrol Details tab:
            \list
                \li Enter a name for the project. Keep in mind that projects
                cannot be easily renamed later.
                \li Select the path for the project files. You can move project
                folders later.
                \li Set the screen resolution for previewing the UI on the
                desktop or on a device. This determines the screen size. You can
                change the screen size later in \l Properties.
                \li Select \uicontrol {Use Qt Virtual Keyboard} to
                enable users to enter text using a virtual keyboard.
                \li In \uicontrol {Target Qt Version}, select the Qt
                version to use for developing the application. While you can
                change the Qt version later in the \uicontrol {Run Settings}
                of the project, keep in mind that the two versions are not fully
                compatible.
            \endlist
        \li In the \uicontrol {Style} tab, select one of
            the predefined \l{Styling Qt Quick Controls}{UI styles} to use.
        \li Select \uicontrol Create to create the project.
    \endlist

    \QDS creates the following files and folders:

    \list
        \li .qmlproject project file defines that all component, JavaScript, and
            image files in the project folder belong to the project. Therefore,
            you do not need to individually list all the files in the project.
        \li .qml file defines the functionality and appearance of a component.
        \li \e Screen01.ui.qml defines a custom component that you can edit in
            the \l {2D} view. For more information, see \l {UI Files}.

            By default, this is the main file in the project, but you can
            change that in the .qmlproject file. While the custom component
            is a good starting point for new users, you don't have to use it.
            Specifically, if you export and import designs using \QB, your main
            file is most likely called something else. For more information,
            see \l {Exporting from Design Tools}.
        \li \e CMakeLists.txt project configuration file allowing you to
            share your project as a fully working C++ application with
            developers.
        \li qtquickcontrols2.conf file specifies the preferred style and some
            style-specific arguments.
        \li \e fonts folder contains font files that you have added in
            \uicontrol Assets.
        \li \e imports folder contains a \e {Constants.qml} file that specifies
            a font loader for the Arial font and the screen resolution. The size
            of the default Screen.ui.qml \l{basic-rectangle}{Rectangle} should
            be set as \c {width: Constants.width & height: Constants.height} so
            that it inherits the global resolution saved here.
        \li \e qmldir module definition file declares the Constant component.
            For more information, see \l {Module Definition qmldir Files}.
    \endlist

    To use JavaScript and image files in the UI, select
    \uicontrol Assets > \inlineimage icons/plus.png
    .

    \section1 Using Custom Presets

    You can save project settings as custom presets. All saved custom presets
    are available on the \uicontrol Custom tab in the
    \uicontrol {Create Project} wizard. You cannot modify custom presets once
    you have created them.

    To create a custom preset:
    \list 1
      \li In the \uicontrol {Create Project} wizard, set the details and style
          that you want to use.
      \li Select \uicontrol {Save Custom Preset} and give a name for the custom
      preset.
    \endlist

    \section1 Adding Files to Projects

    You can use wizard templates to add individual files to projects.

    The wizard templates in the \uicontrol {Qt Quick Controls} category create
    stylable versions of the components in the \uicontrol {Qt Quick Controls}
    module. For more information, see \l{Creating Custom Controls}.

    You can create the following types of files:

    \table
    \header
        \li Category
        \li Wizard Template
        \li Purpose
    \row
        \li {1,4} Qt Quick Files
        \li Flow Item and Flow View
        \li Generate components that you can use to design the
            \l{Designing Application Flows}{application flow}.
    \row
        \li Qt Quick File
        \li Generates a component with one of the following default components
            or \l{Using Positioners}{positioners} as the root component:
            \l {basic-item}{Item}, \l {basic-rectangle}{Rectangle}, \l {Images}
            {Image}, \l {Border Image}, \l Flickable, Row, Column, Flow, or
            Grid.
    \row
        \li Qt Quick UI File
        \li Generates a UI file with one of the above components as the root
            component.
    \row
        \li Qt Quick Views
        \li Generates a Grid View or a List View. For more information, see
            \l{List and Grid Views}.
    \row
        \li {1,9} Qt Quick Controls
        \li Custom Button
        \li Creates a \l {Button}{push button} with a text label.
    \row
        \li Custom \CheckBox
        \li Creates a \l {Check Box}{check box}.
    \row
        \li Custom Dial
        \li Creates a \l {Slider and Dial}{dial}.
    \row
        \li Custom Slider
        \li Creates a \l {Slider and Dial}{slider}.
    \row
        \li Custom \SpinBox
        \li Creates a \l {Spin Box}{spin box}.
    \row
        \li Custom Switch
        \li Creates a \l {Switch}{switch} with on and off states.
    \row
        \li \l Pane
        \li Provides a background that matches the UI style and theme.
    \row
        \li StackView
        \li Provides a stack-based navigation model.
    \row
        \li SwipeView
        \li Enables users to navigate pages by swiping sideways.
    \row
        \li QML Files
        \li ListModel
        \li Adds a \l{Editing List Models}{list model} to the project.
    \row
        \li JavaScript
        \li JavaScript File
        \li Generates files that you can use to write the application logic.
            This is useful for testing the application before the developers
            implement the application logic in C++, for example. For more
            information, see \l {Simulating Application Logic}.
    \endtable
*/
