aboutsummaryrefslogtreecommitdiffstats
path: root/doc/qtdesignstudio/src/qtdesignstudio-projects.qdoc
blob: debd034ed9ac8757f21286128ab5d82896a790bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// 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 studio-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} (\c{.ui.qml}), component files (\c{.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 \e {Not applicable}
        \li Lists your most recently used presets.
    \row
        \li {1,3} 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 3D Extended
        \li Creates a project that uses default and 3D components, such as
            camera, light, model and materials. Extended scene environment is
            also included to enable various built-in effects.
    \row
        \li \QMCU
        \li MCU
        \li Creates an application that uses a subset of default components
            (as supported by \QMCU) that you can deploy, run, and debug
            on MCU boards. For more information, see \l {Creating projects for MCUs}.
    \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 \e {Not applicable}
        \li Lists your saved custom presets.
            \note This tab is not visible if there are no saved custom presets.
    \endtable

    \image studio-project-wizards.webp "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, as described in \l {Overriding the Preview Tool},
                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:

    \image studio-project-files.webp "Qt Design Studio project files"

    \table
        \header
            \li File or folder
            \li Description
        \row
            \li \c {ProjectName.qmlproject}
            \li This file defines that all components, 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. Since \QDS 4.5, the default
                \l {https://doc.qt.io/qt-6/qtqml-syntax-directoryimports.html} {QML import path}
                defined within the \c {.qmlproject} file is \c {"."}. However, you can add more
                import paths by editing the \c {.qmlproject} file.
        \row
            \li \c {ProjectName} (folder)
            \li This folder contains the essential QML files for the project.
        \row
            \li \c {Constants.qml}
            \li This file defines a font loader for the Arial font and the screen resolution.
                The size of the default \c{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. This is the default
                QML singleton created by the wizard. You can add more singletons here. Afterward,
                edit the qmldir file accordingly.
        \row
            \li \c {EventListModel.qml}
            \li This file defines and triggers "Global Events" in a \QDS/QML application.
        \row
            \li \c {EventListSimulator.qml}
            \li This file defines and triggers "Global Events" in a \QDS/QML application.
        \row
            \li qmldir
            \li This is a module definition file that declares the Constant component.
                For more information, see \l {Module Definition qmldir Files}.
        \row
            \li \c {ProjectNameContent} (folder)
            \li This folder contains the default content, such as QML files, images, and other
                necessary files. It is not considered a module in \QDS context. Do not import it
                if you want to make singletons and objects. Use the ProjectName module instead.
        \row
            \li \c {App.qml}
            \li This file defines the default dimension of the application window.
                This is the entry point to QML application.
        \row
            \li \c {Screen01.ui.qml}
            \li This file defines a custom component that you can edit in the \uicontrol {2D} view.
                For more information, see \l {UI files}.
                The project wizard generates this as the first scene.
        \row
            \li \c {qtquickcontrols2.conf}
            \li This file specifies the preferred style and style-specific arguments.
    \endtable

    Depending on the assets, components, effects, and animations you use, the project might include
    additional files and folders.

    \image studio-project-additional-files.webp "Qt Design Studio project files"

    \table
        \header
            \li File or folder
            \li Description
        \row
            \li \c {Generated} (folder)
            \li This folder contains all the files related to
                \l {https://doc.qt.io/qt-6/qtquick3d-index.html} {QtQuick3D} and the modules
                for imported 3D components and elements from the content library,
                such as Materials and Effects.
        \row
            \li \c {Bundles} (folder)
            \li This folder contains imported 3D components and elements from the content library,
                such as Materials.
        \row
            \li \c {QtQuick3D} (folder)
            \li This folder contains all the files from an imported Qt Quick 3D object, such as
                meshes, images, animations, and QML files.

        \row
            \li \c {Effects} (folder)
            \li This folder contains all the files related to the effects created with
                \l {Effect Composer}.
        \row
            \li \c {Materials} (folder)
            \li This folder contains the files related to the materials, such as images, shaders,
                and QML files.

    \endtable

    To use JavaScript and image files in the UI, select
    \uicontrol Assets > \imageplus
    .

    \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 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 Views and Grid Views}.
    \row
        \li Qt Quick UI Form
        \li Creates a UI file along with a matching QML file for
            implementation purposes.
    \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}{checkbox}.
    \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 Stacked Layout
        \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
*/