aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc
blob: c3c938ffe28ec78c0c4dbd173eec7c329b391379 (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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page qtquickcontrols2-imagine.html
    \title Imagine Style

    The Imagine Style is based on configurable image assets. \l{detailed-desc-imagine}{More...}

    \styleimport {QtQuick.Controls.Imagine 2.3} {Qt 5.10}

    \section1 Attached Properties

    \list
        \li \l {imagine-path-attached-prop}{\b path} : string
    \endlist

    \section1 Detailed Description
    \target detailed-desc-imagine

    The Imagine style is based on image assets. The style comes with a default
    set of images, but the images can be easily changed by providing a directory
    with images using a predefined naming convention.

    \image qtquickcontrols2-imagine.png
    \caption The Imagine style with the default images

    To run an application with the Imagine style, see
    \l {Using Styles in Qt Quick Controls 2}.

    \section2 File Names

    The image files are named using the following convention:

    \c <control>-<element>-<states>

    The \c <control> and \c <element> sections are mandatory, but the
    \c <states> section is optional. For example, if a single file named
    \c "button-background.9.png" is provided for \l {Button}, it will be used
    for every state that \c Button supports. It is up to the developer to
    decide the set of states that they will provide images for. However, it
    is recommended to provide images for the most common control states where
    possible, such as \c disabled, \c pressed, etc. This will ensure that
    interactive controls visually behave as the end user would expect them to.

    TODO: mention priority order, scoring system?

    The following table lists which elements are supported for each control,
    along with the possible states for that element, and the file extension
    that it expects. An element is an image that represents a certain visual
    part of the control. For example, \c {Button}'s \c "background" element
    represents its \l {Control::}{background}.

    \table
        \header
            \li Control
            \li Element
            \li States
            \li Extension
        \row
            \li \l ApplicationWindow
            \li background
            \li active
            \li .9.png (or .png)
        \row
            \li
            \li overlay
            \li modal
            \li .9.png (or .png)
        \row
            \li \l BusyIndicator
            \li animation
            \li disabled, running, mirrored, hovered
            \li .webp
        \row
            \li
            \li background
            \li same as above
            \li .webp
        \row
            \li \l Button
            \li background
            \li disabled, pressed, checked, checkable, focused, highlighted, flat, mirrored, hovered
            \li .9.png
        \row
            \li \l CheckBox
            \li background
            \li disabled, pressed, checked, partially-checked, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .png
        \row
            \li \l CheckDelegate
            \li background
            \li disabled, pressed, checked, partially-checked, focused, highlighted, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .png
        \row
            \li \l ComboBox
            \li background
            \li disabled, pressed, editable, open, focused, mirrored, hovered, flat
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .png
        \row
            \li
            \li popup
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l DelayButton
            \li background, progress, mask
            \li disabled, pressed, checked, checkable, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li progress
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li mask
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l Dial
            \li background
            \li disabled, pressed, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li handle
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l Dialog
            \li background
            \li modal, dim
            \li .9.png (or .png)
        \row
            \li
            \li title
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li overlay
            \li modal
            \li .9.png (or .png)
        \row
            \li \l DialogButtonBox
            \li background
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l Drawer
            \li background
            \li modal, dim, top, left, right, bottom
            \li .9.png (or .png)
        \row
            \li
            \li overlay
            \li modal
            \li .9.png (or .png)
        \row
            \li \l Frame
            \li background
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l GroupBox
            \li background
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li
            \li title
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l ItemDelegate
            \li background
            \li disabled, pressed, focused, highlighted, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l Label
            \li background
            \li disabled, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l Menu
            \li background
            \li modal, dim
            \li .9.png (or .png)
        \row
            \li
            \li overlay
            \li modal
            \li .9.png (or .png)
        \row
            \li \l MenuItem
            \li arrow
            \li disabled, pressed, checked, focused, highlighted, mirrored, hovered
            \li .png
        \row
            \li
            \li background
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .png
        \row
            \li \l MenuSeparator
            \li background, separator
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l Page
            \li background
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l PageIndicator
            \li background
            \li disabled, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li delegate
            \li disabled, pressed, current, mirrored, hovered
            \li .png
        \row
            \li \l Pane
            \li background
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l Popup
            \li background
            \li modal, dim
            \li .9.png (or .png)
        \row
            \li
            \li overlay
            \li modal
            \li .9.png (or .png)
        \row
            \li \l ProgressBar
            \li animation
            \li disabled, mirrored, hovered
            \li .png
        \row
            \li
            \li background
            \li disabled, indeterminate, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li mask
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li progress
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l RadioButton
            \li background, indicator
            \li disabled, pressed, checked, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .png
        \row
            \li \l RadioDelegate
            \li background
            \li disabled, pressed, checked, focused, highlighted, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .png
        \row
            \li \l RangeSlider
            \li background
            \li vertical, horizontal, disabled, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l RangeSlider
            \li progress
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li handle
            \li first, second, vertical, horizontal, disabled, pressed, focused, mirrored, hovered
            \li .png
        \row
            \li \l RoundButton
            \li background
            \li disabled, pressed, checked, checkable, focused, highlighted, flat, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l ScrollBar
            \li background
            \li vertical, horizontal, disabled, interactive, pressed, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li handle
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l ScrollIndicator
            \li background
            \li vertical, horizontal, disabled, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li handle
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l ScrollView
            \li background
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l Slider
            \li background
            \li vertical, horizontal, disabled, pressed, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li handle
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li progress
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l SpinBox
            \li background
            \li disabled, editable, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li editor
            \li disabled, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li up, down, disabled, editable, pressed, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l StackView
            \li background
            \li disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l SwipeDelegate
            \li background
            \li disabled, pressed, focused, highlighted, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l SwipeView
            \li background
            \li vertical, horizontal, disabled, interactive, focused, mirrored
            \li .9.png (or .png)
        \row
            \li \l Switch
            \li background, handle, indicator
            \li disabled, pressed, checked, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li handle
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l SwitchDelegate
            \li background, handle, indicator
            \li disabled, pressed, checked, focused, highlighted, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li
            \li handle
            \li same as above
            \li .9.png (or .png)
        \row
            \li
            \li indicator
            \li same as above
            \li .9.png (or .png)
        \row
            \li \l TabBar
            \li background
            \li disabled, header, footer, mirrored
            \li .9.png (or .png)
        \row
            \li \l TabButton
            \li background
            \li disabled, pressed, checked, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l TextArea
            \li background
            \li disabled, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l TextField
            \li background
            \li disabled, focused, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l ToolBar
            \li background
            \li disabled, header, footer, mirrored
            \li .9.png (or .png)
        \row
            \li \l ToolButton
            \li background
            \li disabled, pressed, checked, checkable, focused, highlighted, flat, mirrored, hovered
            \li .9.png (or .png)
        \row
            \li \l ToolSeparator
            \li background, separator
            \li vertical, horizontal, disabled, mirrored
            \li .9.png (or .png)
        \row
            \li \l ToolTip
            \li background
            \li
            \li .9.png (or .png)
        \row
            \li \l Tumbler
            \li background
            \li disabled, focused, mirrored, hovered
            \li .9.png (or .png)
    \endtable

    \section2 9 Patch Images

    ...

    \section2 Animated Images

    ...

    \section2 Palette

    \section2 Customization

    The Imagine style allows customizing the \l {imagine-path-attached-prop}{path}
    that is used to do the image asset selection. The path can be specified for any
    window or item, and it automatically propagates to children in the same manner as
    \l {Control::font}{fonts}. In the following example, the window and all three radio
    buttons appear with dark image assets (files that are located in "qrc:/themes/dark").

    \table
        \row
            \li
                \qml
                import QtQuick 2.0
                import QtQuick.Controls 2.3
                import QtQuick.Controls.Imagine 2.3

                ApplicationWindow {
                    visible: true

                    Imagine.path: "qrc:/themes/dark"

                    Column {
                        anchors.centerIn: parent

                        RadioButton { text: qsTr("Small") }
                        RadioButton { text: qsTr("Medium"); checked: true }
                        RadioButton { text: qsTr("Large") }
                    }
                }
                \endqml
            \li
                \image qtquickcontrols2-imagine-dark.png
    \endtable

    In addition to specifying the path in QML, it is also possible to specify
    it via an environment variable or in a configuration file. Attributes
    specified in QML take precedence over all other methods.

    \section3 Configuration File

    \include qquickimaginestyle.qdocinc conf

    See \l {Qt Quick Controls 2 Configuration File} for more details about the
    configuration file.

    \section3 Environment Variables

    \include qquickimaginestyle.qdocinc env

    See \l {Supported Environment Variables in Qt Quick Controls 2} for the full
    list of supported environment variables.

    \section2 Dependency

    The Imagine style must be separately imported to gain access to the
    attributes that are specific to the Imagine style. It should be noted
    that regardless of the references to the Imagine style, the same
    application code runs with any other style. Imagine-specific attributes
    only have an effect when the application is run with the Imagine style.

    If the Imagine style is imported in a QML file that is always loaded, the
    Imagine style must be deployed with the application in order to be able
    to run the application regardless of which style the application is run with.
    By using \l {Using File Selectors with Qt Quick Controls 2}{file selectors},
    style-specific tweaks can be applied without creating a hard dependency to
    a style.

    \b {See also} \l {Styling Qt Quick Controls 2}

    \section1 Attached Property Documentation

    \styleproperty {Imagine.path} {string} {imagine-path-attached-prop}
    \target imagine-path-attached-prop
    This attached property holds the path to the image assets...

    \code
    Button {
        Imagine.path: "qrc:/themes/dark"
    }
    \endcode

    \endstyleproperty

    \section1 Related Information

    \list
      \li \l{Styling Qt Quick Controls 2}
    \endlist
*/