Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
stylesheet-reference.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page stylesheet-reference.html
6
\previouspage Customizing Qt Widgets Using Style Sheets
7
\nextpage Qt Style Sheets Examples
8
\title Qt Style Sheets Reference
9
10
Qt Style Sheets support various properties, pseudo-states, and
11
subcontrols that make it possible to customize the look of
12
widgets.
13
14
\section1 List of Stylable Widgets
15
16
The following table lists the Qt widgets that can be customized
17
using style sheets:
18
19
\table 100%
20
\header
21
\li Widget
22
\li How to Style
23
24
\row
25
\li QAbstractScrollArea \target qabstractscrollarea-widget
26
\li Supports the \l{box model}.
27
\br
28
\br
29
All derivatives of QAbstractScrollArea, including QTextEdit,
30
and QAbstractItemView (all item view classes), support
31
scrollable backgrounds using
32
\l{Qt Style Sheets Reference#background-attachment-prop}
33
{background-attachment}. Setting the background-attachment to
34
\c{fixed} provides a background-image that does not scroll with the
35
viewport. Setting the background-attachment to \c{scroll}, scrolls
36
the background-image when the scroll bars move.
37
\br
38
\br
39
See \l{Qt Style Sheets Examples#Customizing QAbstractScrollArea}
40
{Customizing QAbstractScrollArea} for an example.
41
42
\row
43
\li QCheckBox \target qcheckbox-widget
44
\li Supports the \l{box model}. The check indicator can be
45
styled using the \l{#indicator-sub}{::indicator}
46
subcontrol. By default, the indicator is placed in the Top
47
Left corner of the Contents rectangle of the widget.
48
\br
49
\br
50
The \l{#spacing-prop}{spacing} property
51
specifies the spacing between the check indicator and
52
the text.
53
\br
54
\br
55
See \l{Qt Style Sheets Examples#Customizing QCheckBox}
56
{Customizing QCheckBox} for an example.
57
58
\row
59
\li QColumnView \target qcolumnview-widget
60
\li The grip can be styled by using the \l{image-prop}{image} property.
61
\br
62
\br
63
The arrow indicators can by styled using the
64
\l{left-arrow-sub}{::left-arrow} subcontrol and the
65
\l{right-arrow-sub}{::right-arrow} subcontrol.
66
67
\row
68
\li QComboBox \target qcombobox-widget
69
\li The frame around the combobox can be styled using the
70
\l{box model}.
71
\br
72
\br
73
The drop-down button can be styled using
74
the \l{#drop-down-sub}{::drop-down} subcontrol. By default, the
75
drop-down button is placed in the top right corner of the padding
76
rectangle of the widget.
77
\br
78
\br
79
The arrow mark inside the drop-down button
80
can be styled using the \l{#down-arrow-sub}{::down-arrow}
81
subcontrol. By default, the arrow is placed in the center of the
82
contents rectangle of the drop-down subcontrol.
83
\br
84
\br
85
The color of the placeholder text can be set using the
86
\l{#placeholder-text-color-prop}{placeholder-text-color} property.
87
\br
88
\br
89
See \l{Qt Style Sheets Examples#Customizing QComboBox}{Customizing QComboBox}
90
for an example.
91
92
\row
93
\li QDateEdit \target qdateedit-widget
94
\li See \l{#qspinbox-widget}{QSpinBox}.
95
96
\row
97
\li QDateTimeEdit \target qdatetimeedit-widget
98
\li See \l{#qspinbox-widget}{QSpinBox}.
99
100
\row
101
\li QDialog \target qdialog-widget
102
\li Supports only the \l{Qt Style Sheets Reference#background-prop}{background},
103
\l{#background-clip-prop}{background-clip} and
104
\l{#background-origin-prop}{background-origin} properties.
105
106
\warning Make sure you define the Q_OBJECT macro for your custom
107
widget.
108
109
\row
110
\li QDialogButtonBox \target qdialogbuttonbox-widget
111
\li The layout of buttons can be altered using the
112
\l{#button-layout-prop}{button-layout} property.
113
114
\row
115
\li QDockWidget \target qdockwidget-widget
116
\li Supports styling of the title bar and the title bar buttons when docked.
117
\br
118
\br
119
The dock widget border can be styled using the \l{#border-prop}{border}
120
property. The \l{#title-sub}{::title} subcontrol can be used to customize
121
the title bar. The close and float buttons are positioned with respect
122
to the \l{title-sub}{::title} subcontrol using the
123
\l{#close-button-sub}{::close-button} and
124
\l{#float-button-sub}{::float-button} respectively.
125
\br
126
\br
127
When the title bar is vertical, the \l{#vertical-ps}{:vertical} pseudo
128
class is set. In addition, depending on QDockWidget::DockWidgetFeature,
129
the \l{#closable-ps}{:closable}, \l{#floatable-ps}{:floatable} and
130
\l{#movable-ps}{:movable} pseudo states are set.
131
132
\note Use QMainWindow::separator to style the resize handle.
133
134
\warning The style sheet has no effect when the QDockWidget is undocked
135
as Qt uses native top level windows when undocked.
136
137
See \l{Qt Style Sheets Examples#Customizing QDockWidget}
138
{Customizing QDockWidget} for an example.
139
140
\row
141
\li QDoubleSpinBox \target qdoublespinbox-widget
142
\li See \l{#qspinbox-widget}{QSpinBox}.
143
144
\row
145
\li QFrame \target qframe-widget
146
\li Supports the \l{box model}.
147
\br
148
\br
149
Since 4.3, setting a stylesheet on a QLabel automatically
150
sets the QFrame::frameStyle property to QFrame::StyledPanel.
151
\br
152
\br
153
See \l{Qt Style Sheets Examples#Customizing QFrame}{Customizing QFrame}
154
for an example.
155
156
\row
157
\li QGroupBox \target qgroupbox-widget
158
\li Supports the \l{box model}.
159
\br
160
\br
161
The title can be styled using the
162
\l{#title-sub}{::title} subcontrol. By default, the title is placed
163
depending on QGroupBox::textAlignment.
164
\br
165
\br
166
In the case of a checkable QGroupBox, the title includes the
167
check indicator. The indicator is styled using the
168
\l{#indicator-sub}{::indicator} subcontrol. The
169
\l{#spacing-prop}{spacing} property can be used to control
170
the spacing between the text and indicator.
171
\br
172
\br
173
See \l{Qt Style Sheets Examples#Customizing QGroupBox}{Customizing QGroupBox}
174
for an example.
175
176
\row
177
\li QHeaderView \target qheaderview-widget
178
\li Supports the \l{box model}.
179
\br
180
\br
181
The sections of the header view are
182
styled using the \l{#section-sub}{::section} sub control. The
183
\c{section} Sub-control supports the \l{#middle-ps}{:middle},
184
\l{#first-ps}{:first}, \l{#last-ps}{:last},
185
\l{#only-one-ps}{:only-one}, \l{#next-selected-ps}{:next-selected},
186
\l{#previous-selected-ps}{:previous-selected},
187
\l{#selected-ps}{:selected},
188
and \l{#checked-ps}{:checked} pseudo states.
189
\br
190
\br
191
The sort indicator can be styled using the
192
\l{#up-arrow-sub}{::up-arrow} and the
193
\l{#down-arrow-sub}{::down-arrow} Sub-control.
194
\br
195
\br
196
See \l{Qt Style Sheets Examples#Customizing QHeaderView}{Customizing QHeaderView}
197
for an example.
198
199
\row
200
\li QLabel \target qlabel-widget
201
\li Supports the \l{box model}. Does not support the
202
\l{#hover-ps}{:hover} pseudo-state.
203
\br
204
\br
205
Since 4.3, setting a stylesheet on a QLabel automatically
206
sets the QFrame::frameStyle property to QFrame::StyledPanel.
207
\br
208
\br
209
See \l{Qt Style Sheets Examples#Customizing QFrame}{Customizing QFrame} for an
210
example (a QLabel derives from QFrame).
211
212
\row
213
\li QLineEdit \target qlineedit-widget
214
\li Supports the \l{box model}.
215
\br
216
\br
217
The color and background of the selected item is styled using
218
\l{#selection-color-prop}{selection-color} and
219
\l{#selection-background-color-prop}{selection-background-color}
220
respectively.
221
\br
222
\br
223
The color of the placeholder text can be set using the
224
\l{#placeholder-text-color-prop}{placeholder-text-color} property.
225
\br
226
\br
227
The password character can be styled using the
228
\l{#lineedit-password-character-prop}{lineedit-password-character}
229
property.
230
\br
231
\br
232
The password mask delay can be changed using the
233
\l{#lineedit-password-mask-delay-prop}{lineedit-password-mask-delay}
234
\br
235
\br
236
See \l{Qt Style Sheets Examples#Customizing QLineEdit}{Customizing QLineEdit}
237
for an example.
238
239
\row
240
\li QListView \target qlistview-widget
241
\li Supports the \l{box model}.
242
\br
243
\br
244
When
245
\l{QAbstractItemView::alternatingRowColors}{alternating row colors}
246
is enabled, the alternating colors can be styled using the
247
\l{#alternate-background-color-prop}{alternate-background-color}
248
property.
249
\br
250
\br
251
The color and background of the selected item is styled using
252
\l{#selection-color-prop}{selection-color} and
253
\l{#selection-background-color-prop}{selection-background-color}
254
respectively.
255
\br
256
\br
257
The selection behavior is controlled by the
258
\l{#show-decoration-selected-prop}{show-decoration-selected} property.
259
\br
260
\br
261
Use the \l{#item-sub}{::item} subcontrol for more fine grained
262
control over the items in the QListView.
263
\br
264
\br
265
See \l{qabstractscrollarea-widget}{QAbstractScrollArea} to
266
style scrollable backgrounds.
267
\br
268
\br
269
See \l{Qt Style Sheets Examples#Customizing QListView}
270
{Customzing QListView} for an example.
271
272
\row
273
\li QListWidget \target qlistwidget-widget
274
\li See \l{#qlistview-widget}{QListView}.
275
276
\row
277
\li QMainWindow \target qmainwindow-widget
278
\li Supports styling of the separator.
279
\br
280
\br
281
The separator in a QMainWindow when using QDockWidget is styled
282
using the \l{#separator-sub}{::separator} subcontrol.
283
\br
284
\br
285
See \l{Qt Style Sheets Examples#Customizing QMainWindow}{Customizing QMainWindow}
286
for an example.
287
288
\row
289
\li QMenu \target qmenu-widget
290
\li Supports the \l{box model}.
291
\br
292
\br
293
Individual items are styled using the \l{#item-sub}{::item}
294
subcontrol. In addition to the usually supported pseudo states,
295
\c{item} subcontrol supports the
296
\l{#selected-ps}{:selected}, \l{#default-ps}{:default},
297
\l{#exclusive-ps}{:exclusive} and the
298
\l{#non-exclusive-ps}{non-exclusive} pseudo states.
299
\br
300
\br
301
The indicator of checkable menu items is styled using the
302
\l{#indicator-sub}{::indicator} subcontrol.
303
\br
304
\br
305
The separator is styled using the \l{#separator-sub}{::separator}
306
subcontrol.
307
\br
308
\br
309
For items with a sub menu, the arrow marks are styled using the
310
\l{right-arrow-sub}{right-arrow} and
311
\l{left-arrow-sub}{left-arrow}.
312
\br
313
\br
314
The scroller is styled using the \l{#scroller-sub}{::scroller}.
315
\br
316
\br
317
The tear-off is styled using the \l{#tearoff-sub}{::tearoff}.
318
\br
319
\br
320
See \l{Qt Style Sheets Examples#Customizing QMenu}{Customizing QMenu}
321
for an example.
322
323
\row
324
\li QMenuBar \target qmenubar-widget
325
\li Supports the \l{box model}.
326
\br
327
\br
328
The \l{#spacing-prop}{spacing}
329
property specifies the spacing between menu items.
330
Individual items are styled using the \l{#item-sub}{::item}
331
subcontrol.
332
333
\warning When running on Qt/Mac, the menu bar is usually embedded into the
334
system-wide menu bar. In this case, the style sheet will have no effect.
335
336
See \l{Qt Style Sheets Examples#Customizing QMenuBar}{Customizing QMenuBar}
337
for an example.
338
339
\row
340
\li QMessageBox \target qmessagebox-widget
341
\li The \l{#messagebox-text-interaction-flags-prop}
342
{messagebox-text-interaction-flags} property can be used to alter
343
the interaction with text in the message box.
344
345
\row
346
\li QProgressBar \target qprogressbar-widget
347
\li Supports the \l{box model}.
348
\br
349
\br
350
The chunks of the progress bar
351
can be styled using the \l{#chunk-sub}{::chunk} subcontrol.
352
The chunk is displayed on the Contents rectangle of the widget.
353
\br
354
\br
355
If the progress bar displays text, use the \l{text-align-prop}{text-align}
356
property to position the text.
357
\br
358
\br
359
Indeterminate progress bars have the
360
\l{#indeterminate-ps}{:indeterminate} pseudo state set.
361
\br
362
\br
363
See \l{Qt Style Sheets Examples#Customizing QProgressBar}{Customizing QProgressBar}
364
for an example.
365
366
\row
367
\li QPushButton \target qpushbutton-widget
368
\li Supports the \l{box model}.
369
\br
370
\br
371
Supports the \l{#default-ps}{:default},
372
\l{#flat-ps}{:flat}, \l{#checked-ps}{:checked} pseudo states.
373
\br
374
\br
375
Since 5.15, the \l{#icon-prop}{icon} property can be set to
376
override the button icon.
377
\br
378
\br
379
For QPushButton with a menu, the menu indicator is styled
380
using the \l{#menu-indicator-sub}{::menu-indicator}
381
subcontrol. Appearance of checkable push buttons can be
382
customized using the \l{#open-ps}{:open} and
383
\l{#closed-ps}{:closed} pseudo-states.
384
385
\warning If you only set a background-color on a QPushButton, the background
386
may not appear unless you set the border property to some value. This is
387
because, by default, the QPushButton draws a native border which completely
388
overlaps the background-color. For example,
389
390
\snippet code/doc_src_stylesheet.qdoc 30
391
392
See \l{Qt Style Sheets Examples#Customizing QPushButton}{Customizing QPushButton}
393
for an example.
394
395
\row
396
\li QRadioButton \target qradiobutton-widget
397
\li Supports the \l{box model}.
398
\br
399
\br
400
The check indicator can be
401
styled using the \l{#indicator-sub}{::indicator}
402
subcontrol. By default, the indicator is placed in the Top
403
Left corner of the Contents rectangle of the widget.
404
\br
405
\br
406
The \l{#spacing-prop}{spacing} property
407
specifies the spacing between the check indicator and
408
the text.
409
\br
410
\br
411
See \l{Qt Style Sheets Examples#Customizing QRadioButton}
412
{Customizing QRadioButton} for an example.
413
414
\row
415
\li QScrollBar \target qscrollbar-widget
416
\li Supports the \l{box model}.
417
\br
418
\br
419
The Contents rectangle of the widget
420
is considered to be the groove over which the slider moves. The extent
421
of the QScrollBar (i.e the width or the height depending on the orientation)
422
is set using the \l{#width-prop}{width} or \l{#height-prop}{height} property
423
respectively. To determine the orientation, use the
424
\l{#horizontal-ps}{:horizontal} and the \l{vertical-ps}{:vertical}
425
pseudo states.
426
\br
427
\br
428
The slider can be styled using the \l{#handle-sub}{::handle} subcontrol.
429
Setting the \l{#min-width-prop}{min-width} or \l{#min-height-prop}{min-height}
430
provides size constraints for the slider depending on the orientation.
431
\br
432
\br
433
The \l{add-line-sub}{::add-line} subcontrol can be used to style the
434
button to add a line. By default, the add-line subcontrol is placed in
435
top right corner of the Border rectangle of the widget. Depending on the
436
orientation the \l{#right-arrow-sub}{::right-arrow} or
437
\l{#down-arrow-sub}{::down-arrow}. By default, the arrows are placed in
438
the center of the Contents rectangle of the add-line subcontrol.
439
\br
440
\br
441
The \l{sub-line-sub}{::sub-line} subcontrol can be used to style the
442
button to subtract a line. By default, the sub-line subcontrol is placed in
443
bottom right corner of the Border rectangle of the widget. Depending on the
444
orientation the \l{#left-arrow-sub}{::left-arrow} or
445
\l{#up-arrow-sub}{::up-arrow}. By default, the arrows are placed in
446
the center of the Contents rectangle of the sub-line subcontrol.
447
\br
448
\br
449
The \l{sub-page-sub}{::sub-page} subcontrol can be used to style the
450
region of the slider that subtracts a page. The \l{add-page-sub}{::add-page}
451
subcontrol can be used to style the region of the slider that adds a page.
452
\br
453
\br
454
See \l{Qt Style Sheets Examples#Customizing QScrollBar}{Customizing QScrollBar}
455
for an example.
456
457
\row
458
\li QSizeGrip \target qsizegrip-widget
459
\li Supports the \l{#width-prop}{width},
460
\l{#height-prop}{height}, and \l{#image-prop}{image}
461
properties.
462
\br
463
\br
464
See \l{Qt Style Sheets Examples#Customizing QSizeGrip}{Customizing QSizeGrip}
465
for an example.
466
467
\row
468
\li QSlider \target qslider-widget
469
\li Supports the \l{box model}.
470
\br
471
\br
472
For horizontal slides, the
473
\l{min-width-prop}{min-width} and \l{height-prop}{height}
474
properties must be provided. For vertical sliders, the
475
\l{min-height-prop}{min-height} and \l{width-prop}{width}
476
properties must be provided.
477
\br
478
\br
479
The groove of the slider is styled
480
using the \l{#groove-sub}{::groove}. The groove is
481
positioned by default in the Contents rectangle of the widget.
482
The thumb of the slider is styled using \l{#handle-sub}{::handle}
483
subcontrol. The subcontrol moves in the Contents rectangle of
484
the groove subcontrol.
485
\br
486
\br
487
See \l{Qt Style Sheets Examples#Customizing QSlider}{Customizing QSlider}
488
for an example.
489
490
\row
491
\li QSpinBox \target qspinbox-widget
492
\li The frame of the spin box can be styled using the \l{box
493
model}.
494
\br
495
\br
496
The up button and arrow can be styled using the
497
\l{#up-button-sub}{::up-button} and
498
\l{#up-arrow-sub}{::up-arrow} subcontrols. By default,
499
the up-button is placed in the top right corner in the
500
Padding rectangle of the widget. Without an explicit size,
501
it occupies half the height of its reference rectangle.
502
The up-arrow is placed in the center of the Contents
503
rectangle of the up-button.
504
\br
505
\br
506
The down button and arrow can be styled using the
507
\l{#down-button-sub}{::down-button} and
508
\l{#down-arrow-sub}{::down-arrow} subcontrols. By default,
509
the down-button is placed in the bottom right corner in the
510
Padding rectangle of the widget. Without an explicit size,
511
it occupies half the height of its reference rectangle.
512
The bottom-arrow is placed in the center of the Contents
513
rectangle of the bottom-button.
514
\br
515
\br
516
See \l{Qt Style Sheets Examples#Customizing QSpinBox}{Customizing QSpinBox}
517
for an example.
518
519
\row
520
\li QSplitter \target qsplitter-widget
521
\li Supports the \l{box model}. The handle of the splitter
522
is styled using the \l{#handle-sub}{::handle} subcontrol.
523
\br
524
\br
525
See \l{Qt Style Sheets Examples#Customizing QSplitter}{Customizing QSplitter}
526
for an example.
527
528
\row
529
\li QStatusBar \target qstatusbar-widget
530
\li Supports only the \l{Qt Style Sheets Reference#background-prop}
531
{background} property.
532
The frame for individual items can be style using the
533
\l{#item-sub}{::item} subcontrol.
534
\br
535
\br
536
See \l{Qt Style Sheets Examples#Customizing QStatusBar}{Customizing QStatusBar}
537
for an example.
538
539
\row
540
\li QTabBar \target qtabbar-widget
541
\li Individual tabs may be styled using the \l{#tab-sub}{::tab} subcontrol.
542
Close buttons using the \l{#close-button-sub}{::close-button}.
543
The tabs support the
544
\l{#only-one-ps}{:only-one}, \l{#first-ps}{:first},
545
\l{#last-ps}{:last}, \l{#middle-ps}{:middle},
546
\l{#previous-selected-ps}{:previous--selected},
547
\l{#next-selected-ps}{:next-selected},
548
\l{#selected-ps}{:selected} pseudo states.
549
\br
550
\br
551
The \l{#top-ps}{:top}, \l{#left-ps}{:left}, \l{#right-ps}{:right},
552
\l{#bottom-ps}{:bottom} pseudo states depending on the orientation
553
of the tabs.
554
\br
555
\br
556
Overlapping tabs for the selected state are created by using
557
negative margins or using the \c{absolute} position scheme.
558
\br
559
\br
560
The tear indicator of the QTabBar is styled using the
561
\l{#tear-sub}{::tear} subcontrol.
562
\br
563
\br
564
QTabBar used two QToolButtons for its scrollers that can be styled
565
using the \c{QTabBar QToolButton} selector. To specify the width
566
of the scroll button use the \l{#scroller-sub}{::scroller}
567
subcontrol.
568
\br
569
\br
570
The alignment of the tabs within the QTabBar is styled
571
using the \l{#Alignment}{alignment} property.
572
\br
573
\warning
574
To change the position of the QTabBar within a QTabWidget, use the
575
\l{#tab-bar-sub}{tab-bar} subcontrol (and set subcontrol-position).
576
577
See \l{Qt Style Sheets Examples#Customizing QTabWidget and QTabBar}{Customizing QTabBar}
578
for an example.
579
580
\row
581
\li QTabWidget \target qtabwidget-widget
582
\li The frame of the tab widget is styled using the
583
\l{#pane-sub}{::pane} subcontrol. The left and right
584
corners are styled using the \l{#left-corner-sub}{::left-corner}
585
and \l{#right-corner-sub}{::right-corner} respectively.
586
The position of the tab bar is controlled using the
587
\l{#tab-bar-sub}{::tab-bar} subcontrol.
588
\br
589
\br
590
By default, the subcontrols have positions of a \l QTabWidget in the
591
\c windows style. To place the \l QTabBar in the center, set the
592
subcontrol-position of the tab-bar subcontrol.
593
\br
594
\br
595
The \l{#top-ps}{:top}, \l{#left-ps}{:left}, \l{#right-ps}{:right},
596
\l{#bottom-ps}{:bottom} pseudo states depending on the orientation
597
of the tabs.
598
\br
599
\br
600
See \l{Qt Style Sheets Examples#Customizing QTabWidget and QTabBar}
601
{Customizing QTabWidget} for an example.
602
603
\row
604
\li QTableView \target qtableview-widget
605
\li Supports the \l{box model}. When
606
\l{QAbstractItemView::alternatingRowColors}{alternating row colors}
607
is enabled, the alternating colors can be styled using the
608
\l{#alternate-background-color-prop}{alternate-background-color}
609
property.
610
\br
611
\br
612
The color and background of the selected item is styled using
613
\l{#selection-color-prop}{selection-color} and
614
\l{#selection-background-color-prop}{selection-background-color}
615
respectively.
616
\br
617
\br
618
The corner widget in a QTableView is implemented as a QAbstractButton
619
and can be styled using the "QTableView QTableCornerButton::section"
620
selector.
621
\br
622
\warning If you only set a background-color on a QTableCornerButton,
623
the background may not appear unless you set the border property to
624
some value. This is because, by default, the QTableCornerButton draws a
625
native border which completely overlaps the background-color.
626
627
\br
628
The color of the grid can be specified using the
629
\l{#gridline-color-prop}{gridline-color} property.
630
\br
631
\br
632
See \l{qabstractscrollarea-widget}{QAbstractScrollArea} to
633
style scrollable backgrounds.
634
\br
635
\br
636
See \l{Qt Style Sheets Examples#Customizing QTableView}
637
{Customzing QTableView} for an example.
638
639
\row
640
\li QTableWidget \target qtablewidget-widget
641
\li See \l{#qtableview-widget}{QTableView}.
642
643
\row
644
\li QTextEdit \target qtextedit-widget
645
\li Supports the \l{box model}.
646
\br
647
\br
648
The color and background of selected text is styled using
649
\l{#selection-color-prop}{selection-color} and
650
\l{#selection-background-color-prop}{selection-background-color}
651
respectively.
652
\br
653
\br
654
The color of the placeholder text can be set using the
655
\l{#placeholder-text-color-prop}{placeholder-text-color} property.
656
\br
657
\br
658
See \l{qabstractscrollarea-widget}{QAbstractScrollArea} to
659
style scrollable backgrounds.
660
661
\row
662
\li QTimeEdit \target qtimeedit-widget
663
\li See \l{#qspinbox-widget}{QSpinBox}.
664
665
\row
666
\li QToolBar \target qtoolbar-widget
667
\li Supports the \l{box model}.
668
\br
669
\br
670
The \l{#top-ps}{:top}, \l{#left-ps}{:left}, \l{#right-ps}{:right},
671
\l{#bottom-ps}{:bottom} pseudo states depending on the area in
672
which the tool bar is grouped.
673
\br
674
\br
675
The \l{#first-ps}{:first}, \l{#last-ps}{:last}, \l{#middle-ps}{:middle},
676
\l{#only-one-ps}{:only-one} pseudo states indicator the position
677
of the tool bar within a line group (See
678
QStyleOptionToolBar::positionWithinLine).
679
\br
680
\br
681
The separator of a QToolBar is styled using the
682
\l{#separator-sub}{::separator} subcontrol.
683
\br
684
\br
685
The handle (to move the toolbar) is styled using the
686
\l{#handle-sub}{::handle} subcontrol.
687
\br
688
\br
689
See \l{Qt Style Sheets Examples#Customizing QToolBar}{Customizing QToolBar}
690
for an example.
691
692
\row
693
\li QToolBox \target qtoolbox-widget
694
\li Supports the \l{box model}.
695
\br
696
\br
697
The individual tabs can by styled using the
698
\l{#tab-sub}{::tab} subcontrol. The tabs support the
699
\l{#only-one-ps}{:only-one}, \l{#first-ps}{:first},
700
\l{#last-ps}{:last}, \l{#middle-ps}{:middle},
701
\l{#previous-selected-ps}{:previous-selected},
702
\l{#next-selected-ps}{:next-selected},
703
\l{#selected-ps}{:selected} pseudo states.
704
705
\row
706
\li QToolButton \target qtoolbutton-widget
707
\li Supports the \l{box model}.
708
\br
709
\br
710
If the QToolButton has a menu, is
711
\l{#menu-indicator-sub}{::menu-indicator} subcontrol can be used to
712
style the indicator. By default, the menu-indicator is positioned
713
at the bottom right of the Padding rectangle of the widget.
714
\br
715
\br
716
If the QToolButton is in QToolButton::MenuButtonPopup mode,
717
the \l{#menu-button-sub}{::menu-button} subcontrol is used to draw the
718
menu button. \l{#menu-arrow-sub}{::menu-arrow} subcontrol is used to
719
draw the menu arrow inside the menu-button. By default, it is
720
positioned in the center of the Contents rectangle of the
721
menu-button subcontrol.
722
\br
723
\br
724
When the QToolButton displays arrows, the \l{#up-arrow-sub}{::up-arrow},
725
\l{#down-arrow-sub}{::down-arrow}, \l{#left-arrow-sub}{::left-arrow}
726
and \l{#right-arrow-sub}{::right-arrow} subcontrols are used.
727
\br
728
\warning If you only set a background-color on a QToolButton, the background
729
will not appear unless you set the border property to some value. This is
730
because, by default, the QToolButton draws a native border which completely
731
overlaps the background-color. For example,
732
733
\snippet code/doc_src_stylesheet.qdoc 31
734
735
See \l{Qt Style Sheets Examples#Customizing QToolButton}{Customizing QToolButton}
736
for an example.
737
738
\row
739
\li QToolTip \target qtooltip-widget
740
\li Supports the \l{box model}. The \l{#opacity-prop}{opacity}
741
property controls the opacity of the tooltip.
742
\br
743
\br
744
See \l{Qt Style Sheets Examples#Customizing QFrame}{Customizing QFrame}
745
for an example (a QToolTip is a QFrame).
746
747
\row
748
\li QTreeView \target qtreeview-widget
749
\li Supports the \l{box model}. When
750
\l{QAbstractItemView::alternatingRowColors}{alternating row colors}
751
is enabled, the alternating colors can be styled using the
752
\l{#alternate-background-color-prop}{alternate-background-color}
753
property.
754
\br
755
\br
756
The color and background of the selected item is styled using
757
\l{#selection-color-prop}{selection-color} and
758
\l{#selection-background-color-prop}{selection-background-color}
759
respectively.
760
\br
761
\br
762
The selection behavior is controlled by the
763
\l{#show-decoration-selected-prop}{show-decoration-selected} property.
764
\br
765
\br
766
The branches of the tree view can be styled using the
767
\l{#branch-sub}{::branch} subcontrol. The
768
::branch Sub-control supports the \l{open-ps}{:open},
769
\l{closed-ps}{:closed}, \l{has-siblings-ps}{:has-sibling} and
770
\l{has-children-ps}{:has-children} pseudo states.
771
\br
772
\br
773
Use the \l{#item-sub}{::item} subcontrol for more fine grained
774
control over the items in the QTreeView.
775
\br
776
\br
777
See \l{qabstractscrollarea-widget}{QAbstractScrollArea} to
778
style scrollable backgrounds.
779
\br
780
\br
781
See \l{Qt Style Sheets Examples#Customizing QTreeView}{Customizing QTreeView}
782
for an example to style the branches.
783
784
\row
785
\li QTreeWidget \target qtreewidget-widget
786
\li See \l{#qtreeview-widget}{QTreeView}.
787
788
\row
789
\li QWidget \target qwidget-widget
790
\li Supports only the \l{Qt Style Sheets Reference#background-prop}{background},
791
\l{#background-clip-prop}{background-clip} and
792
\l{#background-origin-prop}{background-origin} properties.
793
\br
794
\br
795
If you subclass from QWidget, you need to provide a paintEvent for your
796
custom QWidget as below:
797
\snippet code/doc_src_stylesheet.cpp 32
798
799
The above code is a no-operation if there is no stylesheet set.
800
801
\warning Make sure you define the Q_OBJECT macro for your custom
802
widget.
803
804
\endtable
805
806
\section1 List of Properties
807
808
This section lists all the properties supported by Qt Style
809
Sheets. Which values can be given to a property depend on the
810
\l{List of Property Types}{property's type}. Unless otherwise
811
specified, the following properties apply to all widgets. Properties
812
marked with an asterisk * are specific to Qt and have no equivalent
813
in CSS2 or CSS3. The Qt-specific properties are the following:
814
\list
815
\li \l{#gridline-color*}{gridline-color*}
816
\li \l{#image*}{image*}
817
\li \l{#lineedit-password-character*}{lineedit-password-character*}
818
\li \l{#lineedit-password-mask-delay*}{lineedit-password-mask-delay*}
819
\li \l{#messagebox-text-interaction-flags*}{messagebox-text-interaction-flags*}
820
\li \l{#opacity*}{opacity*}
821
\li \l{#placeholder-text-color*}{placeholder-text-color*}
822
\li \l{#selection-background-color*}{selection-background-color*}
823
\li \l{#selection-color*}{selection-color*}
824
\li \l{#show-decoration-selected*}{show-decoration-selected*}
825
\li \l{#spacing*}{spacing*}
826
\li \l{#subcontrol-origin*}{subcontrol-origin*}
827
\li \l{#subcontrol-position*}{subcontrol-position*}
828
\li \l{#widget-animation-duration*}{widget-animation-duration*}
829
\endlist
830
831
\section2 accent-color
832
833
\table
834
\row \li \b Type \li \l{#Brush}{Brush}
835
\endtable
836
837
The property sets the \c Accent, which is used to emphasize
838
interactive UI elements. If this property is not set, it defaults to the \c highlight color.
839
840
\section2 alternate-background-color
841
\target alternate-background-color-prop
842
\table
843
\row \li \b Type \li \l{#Brush}{Brush}
844
\endtable
845
The \l{QAbstractItemView::alternatingRowColors}
846
{alternate background color} used in QAbstractItemView subclasses.
847
848
If this property is not set, the default value is
849
whatever is set for the palette's
850
\l{QPalette::}{AlternateBase} role.
851
852
Example:
853
854
\snippet code/doc_src_stylesheet.qdoc 33
855
856
See also \l{Qt Style Sheets Reference#background-prop}{background} and
857
\l{#selection-background-color-prop}{selection-background-color}.
858
859
\section2 background
860
\target background-prop
861
\table
862
\row \li \b Type \li \l{#Background}{Background}
863
\endtable
864
Shorthand notation for setting the background. Equivalent
865
to specifying \c background-color, \c background-image, \c
866
background-repeat, and/or \c background-position.
867
868
This property is supported by QAbstractItemView
869
subclasses, QAbstractSpinBox subclasses, QCheckBox,
870
QComboBox, QDialog, QFrame, QGroupBox, QLabel, QLineEdit,
871
QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
872
QTextEdit, QToolTip, and plain \l{QWidget}s.
873
874
Example:
875
876
\snippet code/doc_src_stylesheet.qdoc 34
877
878
879
Often, it is required to set a fill pattern similar to the styles
880
in Qt::BrushStyle. You can use the background-color property for
881
Qt::SolidPattern, Qt::RadialGradientPattern, Qt::LinearGradientPattern
882
and Qt::ConicalGradientPattern. The other patterns are easily achieved
883
by creating a background image that contains the pattern.
884
885
Example:
886
887
\snippet code/doc_src_stylesheet.qdoc 35
888
889
See also \l{#background-origin-prop}{background-origin},
890
\l{#selection-background-color-prop}{selection-background-color},
891
\l{#background-clip-prop}{background-clip},
892
\l{#background-attachment-prop}{background-attachment}
893
and \l{#alternate-background-color-prop}{alternate-background-color}.
894
895
\section2 background-color
896
\target background-color-prop
897
\table
898
\row \li \b Type \li \l{#Brush}{Brush}
899
\endtable
900
The background color used for the widget.
901
902
Examples:
903
904
\snippet code/doc_src_stylesheet.qdoc 36
905
906
\section2 background-image
907
\target background-image-prop
908
\table
909
\row \li \b Type \li \l{#Url}{Url}
910
\endtable
911
The background image used for the widget. Semi-transparent
912
parts of the image let the \c background-color shine
913
through.
914
915
Example:
916
917
\snippet code/doc_src_stylesheet.qdoc 37
918
919
920
\section2 background-repeat
921
\target background-repeat-prop
922
\table
923
\row \li \b Type \li \l{#Repeat}{Repeat}
924
\endtable
925
Whether and how the background image is repeated to fill
926
the \c background-origin rectangle.
927
928
If this property is not specified, the background image
929
is repeated in both directions (\c repeat).
930
931
Example:
932
933
\snippet code/doc_src_stylesheet.qdoc 38
934
935
\section2 background-position
936
\table
937
\row \li \b Type \li \l{#Alignment}{Alignment}
938
\endtable
939
The alignment of the background image within the \c
940
background-origin rectangle.
941
942
If this property is not specified, the alignment is \c
943
top \c left.
944
945
Example:
946
947
\snippet code/doc_src_stylesheet.qdoc 39
948
949
\section2 background-attachment
950
\target background-attachment-prop
951
\table
952
\row \li \b Type \li \l{#Attachment}{Attachment}
953
\endtable
954
Determines whether the background-image in a QAbstractScrollArea
955
is scrolled or fixed with respect to the viewport.
956
By default, the background-image scrolls with the viewport.
957
958
Example:
959
960
\snippet code/doc_src_stylesheet.qdoc 40
961
962
See also \l{Qt Style Sheets Reference#background-prop}{background}
963
964
\section2 background-clip
965
\target background-clip-prop
966
\table
967
\row \li \b Type \li \l{#Origin}{Origin}
968
\endtable
969
The widget's rectangle, in which the \c background is drawn.
970
971
This property specifies the rectangle to which the \c background-color
972
and \c background-image are clipped.
973
974
This property is supported by QAbstractItemView
975
subclasses, QAbstractSpinBox subclasses, QCheckBox,
976
QComboBox, QDialog, QFrame, QGroupBox, QLabel,
977
QPushButton, QRadioButton, QSplitter, QTextEdit, QToolTip,
978
and plain \l{QWidget}s.
979
980
If this property is not specified, the default is \c
981
border.
982
983
Example:
984
985
\snippet code/doc_src_stylesheet.qdoc 41
986
987
See also \l{Qt Style Sheets Reference#background-prop}{background},
988
\l{#background-origin-prop}{background-origin} and \l{The Box Model}.
989
990
\section2 background-origin
991
\target background-origin-prop
992
\table
993
\row \li \b Type \li \l{#Origin}{Origin}
994
\endtable
995
996
The widget's background rectangle, to use in conjunction
997
with \c background-position and \c background-image.
998
999
This property is supported by QAbstractItemView
1000
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1001
QComboBox, QDialog, QFrame, QGroupBox, QLabel,
1002
QPushButton, QRadioButton, QSplitter, QTextEdit, QToolTip,
1003
and plain \l{QWidget}s.
1004
1005
If this property is not specified, the default is \c
1006
padding.
1007
1008
Example:
1009
1010
\snippet code/doc_src_stylesheet.qdoc 42
1011
1012
See also \l{Qt Style Sheets Reference#background-prop}{background} and
1013
\l{The Box Model}.
1014
1015
\section2 border
1016
\target border-prop
1017
\table
1018
\row \li \b Type \li \l{#Border}{Border}
1019
\endtable
1020
1021
Shorthand notation for setting the widget's border. Equivalent
1022
to specifying \c border-color, \c border-style, and/or
1023
\c border-width.
1024
1025
This property is supported by QAbstractItemView
1026
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1027
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit,
1028
QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
1029
QTextEdit, QToolTip, and plain \l{QWidget}s.
1030
1031
Example:
1032
1033
\snippet code/doc_src_stylesheet.qdoc 43
1034
1035
\section2 border-top
1036
1037
\table
1038
\row \li \b Type \li \l{#Border}{Border}
1039
\endtable
1040
1041
Shorthand notation for setting the widget's top border.
1042
Equivalent to specifying \c border-top-color, \c
1043
border-top-style, and/or \c border-top-width.
1044
1045
\section2 border-right
1046
\table
1047
\row \li \b Type \li \l{#Border}{Border}
1048
\endtable
1049
1050
Shorthand notation for setting the widget's right border.
1051
Equivalent to specifying \c border-right-color, \c
1052
border-right-style, and/or \c border-right-width.
1053
1054
\section2 border-bottom
1055
\table
1056
\row \li \b Type \li \l{#Border}{Border}
1057
\endtable
1058
1059
Shorthand notation for setting the widget's bottom border.
1060
Equivalent to specifying \c border-bottom-color, \c
1061
border-bottom-style, and/or \c border-bottom-width.
1062
1063
\section2 border-left
1064
\table
1065
\row \li \b Type \li \l{#Border}{Border}
1066
\endtable
1067
1068
Shorthand notation for setting the widget's left border.
1069
Equivalent to specifying \c border-left-color, \c
1070
border-left-style, and/or \c border-left-width.
1071
1072
1073
\section2 border-color
1074
\target border-attrs
1075
\target border-color-prop
1076
\table
1077
\row \li \b Type \li \l{#Box Colors}{Box Colors}
1078
\endtable
1079
1080
The color of all the border's edges. Equivalent to
1081
specifying \c border-top-color, \c border-right-color, \c
1082
border-bottom-color, and \c border-left-color.
1083
1084
This property is supported by QAbstractItemView
1085
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1086
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit,
1087
QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
1088
QTextEdit, QToolTip, and plain \l{QWidget}s.
1089
1090
If this property is not specified, it defaults to
1091
\l{#color-prop}{color} (i.e., the widget's foreground
1092
color).
1093
1094
Example:
1095
1096
\snippet code/doc_src_stylesheet.qdoc 44
1097
1098
See also \l{Qt Style Sheets Reference#border-style-prop}{border-style},
1099
\l{Qt Style Sheets Reference#border-width-prop}{border-width},
1100
\l{#border-image-prop}{border-image}, and \l{The Box Model}.
1101
1102
\section2 border-top-color
1103
\table
1104
\row \li \b Type \li \l{#Brush}{Brush}
1105
\endtable
1106
1107
The color of the border's top edge.
1108
1109
\section2 border-right-color
1110
\table
1111
\row \li \b Type \li \l{#Brush}{Brush}
1112
\endtable
1113
1114
The color of the border's right edge.
1115
1116
\section2 border-bottom-color
1117
\table
1118
\row \li \b Type \li \l{#Brush}{Brush}
1119
\endtable
1120
1121
The color of the border's bottom edge.
1122
1123
\section2 border-left-color
1124
\table
1125
\row \li \b Type \li \l{#Brush}{Brush}
1126
\endtable
1127
1128
The color of the border's left edge.
1129
1130
\section2 border-image
1131
\target border-image-prop
1132
\table
1133
\row \li \b Type \li \l{#Border Image}{Border Image}
1134
\endtable
1135
1136
The image used to fill the border. The image is cut into
1137
nine parts and stretched appropriately if necessary. See
1138
\l{#Border Image}{Border Image} for details.
1139
1140
This property is supported by QAbstractItemView
1141
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1142
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit,
1143
QMenu, QMenuBar, QPushButton, QRadioButton, QSplitter,
1144
QTextEdit and QToolTip.
1145
1146
See also \l{#border-color-prop}{border-color},
1147
\l{Qt Style Sheets Reference#border-style-prop}{border-style},
1148
\l{Qt Style Sheets Reference#border-width-prop}{border-width}, and
1149
\l{The Box Model}.
1150
1151
\section2 border-radius
1152
\target border-radius-prop
1153
\table
1154
\row \li \b Type \li \l{#Radius}{Radius}
1155
\endtable
1156
1157
The radius of the border's corners. Equivalent to
1158
specifying \c border-top-left-radius, \c
1159
border-top-right-radius, \c border-bottom-right-radius,
1160
and \c border-bottom-left-radius.
1161
1162
The border-radius clips the element's
1163
\l{Qt Style Sheets Reference#background-prop}{background}.
1164
1165
This property is supported by QAbstractItemView
1166
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1167
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1168
QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
1169
and QToolTip.
1170
1171
If this property is not specified, it defaults to 0.
1172
1173
Example:
1174
1175
\snippet code/doc_src_stylesheet.qdoc 45
1176
1177
See also \l{Qt Style Sheets Reference#border-width-prop}{border-width} and
1178
\l{The Box Model}.
1179
1180
\section2 border-top-left-radius
1181
\table
1182
\row \li \b Type \li \l{#Radius}{Radius}
1183
\endtable
1184
1185
The radius of the border's top-left corner.
1186
1187
\section2 border-top-right-radius
1188
\table
1189
\row \li \b Type \li \l{#Radius}{Radius}
1190
\endtable
1191
1192
The radius of the border's top-right corner.
1193
1194
\section2 border-bottom-right-radius
1195
\table
1196
\row \li \b Type \li \l{#Radius}{Radius}
1197
\endtable
1198
1199
The radius of the border's bottom-right corner. Setting
1200
this property to a positive value results in a rounded
1201
corner.
1202
1203
\section2 border-bottom-left-radius
1204
\table
1205
\row \li \b Type \li \l{#Radius}{Radius}
1206
\endtable
1207
1208
The radius of the border's bottom-left corner. Setting this
1209
property to a positive value results in a rounded corner.
1210
1211
\section2 border-style
1212
\target border-style-prop
1213
\table
1214
\row \li \b Type \li \l{#Border Style}{Border Style}
1215
\endtable
1216
1217
The style of all the border's edges.
1218
1219
This property is supported by QAbstractItemView
1220
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1221
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1222
QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
1223
and QToolTip.
1224
1225
If this property is not specified, it defaults to \c none.
1226
1227
Example:
1228
1229
\snippet code/doc_src_stylesheet.qdoc 46
1230
1231
See also \l{#border-color-prop}{border-color},
1232
\l{Qt Style Sheets Reference#border-style-prop}{border-style},
1233
\l{#border-image-prop}{border-image}, and \l{The Box Model}.
1234
1235
\section2 border-top-style
1236
\table
1237
\row \li \b Type \li \l{#Border Style}{Border Style}}
1238
\endtable
1239
1240
The style of the border's top edge.
1241
1242
\section2 border-right-style
1243
\table
1244
\row \li \b Type \li \l{#Border Style}{Border Style}
1245
\endtable
1246
1247
The style of the border's right edge.
1248
1249
\section2 border-bottom-style
1250
\table
1251
\row \li \b Type \li \l{#Border Style}{Border Style}
1252
\endtable
1253
1254
The style of the border's bottom edge.
1255
1256
\section2 border-left-style
1257
\table
1258
\row \li \b Type \li \l{#Border Style}{Border Style}
1259
\endtable
1260
1261
The style of the border's left edge.
1262
1263
\section2 border-width
1264
\target border-width-prop
1265
\table
1266
\row \li \b Type \li \l{#Box Lengths}{Box Lengths}
1267
\endtable
1268
1269
The width of the border. Equivalent to setting \c
1270
border-top-width, \c border-right-width, \c
1271
border-bottom-width, and \c border-left-width.
1272
1273
This property is supported by QAbstractItemView
1274
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1275
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1276
QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
1277
and QToolTip.
1278
1279
Example:
1280
1281
\snippet code/doc_src_stylesheet.qdoc 47
1282
1283
See also \l{#border-color-prop}{border-color},
1284
\l{#border-radius-prop}{border-radius},
1285
\l{Qt Style Sheets Reference#border-style-prop}{border-style},
1286
\l{#border-image-prop}{border-image}, and
1287
\l{The Box Model}.
1288
1289
\section2 border-top-width
1290
\table
1291
\row \li \b Type \li \l{#Length}{Length}
1292
\endtable
1293
1294
The width of the border's top edge.
1295
1296
\section2 border-right-width
1297
\table
1298
\row \li \b Type \li \l{#Length}{Length}
1299
\endtable
1300
1301
The width of the border's right edge.
1302
1303
\section2 border-bottom-width
1304
\table
1305
\row \li \b Type \li \l{#Length}{Length}
1306
\endtable
1307
1308
The width of the border's bottom edge.
1309
1310
\section2 border-left-width
1311
\table
1312
\row \li \b Type \li \l{#Length}{Length}
1313
\endtable
1314
1315
The width of the border's left edge.
1316
1317
\section2 bottom
1318
\target bottom-prop
1319
\table
1320
\row \li \b Type \li \l{#Length}{Length}
1321
\endtable
1322
1323
If \l{#position-prop}{position} is \c relative (the
1324
default), moves a subcontrol by a certain offset up;
1325
specifying \tt{bottom: \e{y}} is then equivalent to
1326
specifying \tt{\l{Qt Style Sheets Reference#top-prop}{top}: -\e{y}}.
1327
1328
If \l{#position-prop}{position} is \c absolute, the \c
1329
bottom property specifies the subcontrol's bottom edge
1330
in relation to the parent's bottom edge (see also
1331
\l{Qt Style Sheets Reference#subcontrol-origin-prop}
1332
{subcontrol-origin}).
1333
1334
Example:
1335
1336
\snippet code/doc_src_stylesheet.qdoc 48
1337
1338
See also \l{Qt Style Sheets Reference#left-prop}{left}, \l{#right-prop}{right}, and
1339
\l{Qt Style Sheets Reference#top-prop}{top}.
1340
1341
1342
\section2 button-layout
1343
\target button-layout-prop
1344
\table
1345
\row \li \b Type \li \l{#Number}{Number}
1346
\endtable
1347
1348
The layout of buttons in a QDialogButtonBox or
1349
a QMessageBox. The possible values are 0
1350
(\l{QDialogButtonBox::}{WinLayout}), 1
1351
(\l{QDialogButtonBox::}{MacLayout}), 2
1352
(\l{QDialogButtonBox::}{KdeLayout}), 3
1353
(\l{QDialogButtonBox::}{GnomeLayout}) and 5
1354
(\l{QDialogButtonBox::}{AndroidLayout}).
1355
1356
If this property is not specified, it defaults to the
1357
value specified by the current style for the
1358
\l{QStyle::}{SH_DialogButtonLayout} style hint.
1359
1360
Example:
1361
1362
\snippet code/doc_src_stylesheet.qdoc 49
1363
1364
1365
\section2 color
1366
\target color-prop
1367
\table
1368
\row \li \b Type \li \l{#Brush}{Brush} \br
1369
\endtable
1370
1371
The color used to render text.
1372
1373
This property is supported by all widgets that respect
1374
the \l QWidget::palette.
1375
1376
If this property is not set, the default is whatever is
1377
set for in the widget's palette for the
1378
QWidget::foregroundRole (typically black).
1379
1380
Example:
1381
1382
\snippet code/doc_src_stylesheet.qdoc 50
1383
1384
See also \l{Qt Style Sheets Reference#background-prop}{background} and
1385
\l{#selection-color-prop}{selection-color}.
1386
1387
\section2 dialogbuttonbox-buttons-have-icons
1388
\table
1389
\row \li \b Type \li \l{#Boolean}{Boolean}
1390
\endtable
1391
1392
Whether the buttons in a QDialogButtonBox show icons
1393
1394
If this property is set to 1, the buttons of a QDialogButtonBox
1395
show icons; if it is set to 0, the icons are not shown.
1396
1397
See the \l{Qt Style Sheets Reference#list of icons}{List of Icons}
1398
section for information on how to set icons.
1399
1400
\snippet code/doc_src_stylesheet.qdoc 51
1401
1402
\note Styles defining this property must be applied before the
1403
QDialogButtonBox is created; this means that you must apply the
1404
style to the parent widget or to the application itself.
1405
1406
\omit
1407
\row
1408
\li \b{\c etch-disabled-text}*
1409
\li \l{#Boolean}{Boolean}
1410
\li Whether disabled text is drawn etched.
1411
1412
If this property is not specified, it defaults to the
1413
value specified by the current style for the
1414
\l{QStyle::}{SH_EtchDisabledText} style hint.
1415
1416
Example:
1417
1418
\snippet code/doc_src_stylesheet.qdoc 52
1419
\endomit
1420
1421
\section2 font
1422
\target font-prop
1423
\table
1424
\row \li \b Type \li \l{#Font}{Font}
1425
\endtable
1426
1427
Shorthand notation for setting the text's font. Equivalent
1428
to specifying \c font-family, \c font-size, \c font-style,
1429
and/or \c font-weight.
1430
1431
This property is supported by all widgets that respect
1432
the \l QWidget::font.
1433
1434
If this property is not set, the default is the
1435
QWidget::font.
1436
1437
Example:
1438
1439
\snippet code/doc_src_stylesheet.qdoc 53
1440
1441
\section2 font-family
1442
\table
1443
\row \li \b Type \li String
1444
\endtable
1445
1446
The font family.
1447
1448
Example:
1449
1450
\snippet code/doc_src_stylesheet.qdoc 54
1451
1452
\section2 font-size
1453
\table
1454
\row \li \b Type \li \l{#Font Size}{Font Size}
1455
\endtable
1456
1457
The font size. In this version of Qt, only pt and px metrics are
1458
supported.
1459
1460
Example:
1461
1462
\snippet code/doc_src_stylesheet.qdoc 55
1463
1464
\section2 font-style
1465
\table
1466
\row \li \b Type \li \l {#Font Style} {Font Style}
1467
\endtable
1468
1469
The font style.
1470
1471
Example:
1472
1473
\snippet code/doc_src_stylesheet.qdoc 56
1474
1475
\section2 font-weight
1476
\table
1477
\row \li \b Type \li \l{#Font Weight}{Font Weight}
1478
\endtable
1479
1480
The weight of the font.
1481
1482
\section2 gridline-color*
1483
\target gridline-color-prop
1484
\table
1485
\row \li \b Type \li \l{#Color}{Color}
1486
\endtable
1487
1488
The color of the grid line in a QTableView.
1489
1490
If this property is not specified, it defaults to the
1491
value specified by the current style for the
1492
\l{QStyle::}{SH_Table_GridLineColor} style hint.
1493
1494
Example:
1495
1496
\snippet code/doc_src_stylesheet.qdoc 57
1497
1498
1499
\section2 height
1500
\target height-prop
1501
\table
1502
\row \li \b Type \li \l{#Length}{Length}
1503
\endtable
1504
1505
The height of a subcontrol (or in some case, a widget).
1506
1507
If this property is not specified, it defaults to a value
1508
that depends on the subcontrol/widget and on the current style.
1509
1510
\warning Unless otherwise specified, this property has no effect
1511
when set on widgets. If you want a widget with a fixed height, set
1512
the \l{#min-width-prop}{min-height} and
1513
\l{#max-width-prop}{max-height} to the same value.
1514
1515
Example:
1516
1517
\snippet code/doc_src_stylesheet.qdoc 58
1518
1519
See also \l{#width-prop}{width}.
1520
1521
\section2 icon
1522
\target icon-prop
1523
\table
1524
\row \li \b Type \li \l{#Url}{Url}+
1525
\endtable
1526
1527
The icon that is used, for widgets that have an icon.
1528
1529
The only widget currently supporting this property is QPushButton.
1530
1531
\note It's the application's responsibility to assign an icon to a
1532
button (using the QAbstractButton API), and not the style's. So be
1533
careful setting it unless your stylesheet is targeting a specific
1534
application.
1535
1536
Available since 5.15.
1537
1538
\section2 icon-size
1539
\target icon-size-prop
1540
\table
1541
\row \li \b Type \li \l{#Length}{Length}
1542
\endtable
1543
1544
The width and height of the icon in a widget.
1545
1546
The icon size of the following widgets can be set using this
1547
property.
1548
\list
1549
\li QCheckBox
1550
\li QListView
1551
\li QPushButton
1552
\li QRadioButton
1553
\li QTabBar
1554
\li QToolBar
1555
\li QToolBox
1556
\li QTreeView
1557
\endlist
1558
1559
\section2 image*
1560
\target image-prop
1561
\table
1562
\row \li \b Type \li \l{#Url}{Url}+
1563
\endtable
1564
1565
The image that is drawn in the contents rectangle of a
1566
subcontrol.
1567
1568
The image property accepts a list of \l{#Url}{Url}s or
1569
a \c{svg}. The actual image that is drawn is determined
1570
using the same algorithm as QIcon (i.e) the image is never scaled
1571
up but always scaled down if necessary. If a \c{svg} is specified,
1572
the image is scaled to the size of the contents rectangle.
1573
Setting the size of a \c{svg} can be done with the
1574
\l{#width-prop}{width} and \l{#height-prop}{height} property
1575
(supported since Qt 6.13)
1576
1577
Setting the image property on sub controls implicitly sets the
1578
width and height of the sub-control (unless the image in a SVG).
1579
1580
Use \l{image-position-prop}{image-position} to align the image
1581
within the rectangle.
1582
1583
This property is for subcontrols only--we don't support it for
1584
other elements.
1585
1586
\warning The QIcon SVG plugin is needed to render SVG images.
1587
1588
Example:
1589
1590
\snippet code/doc_src_stylesheet.qdoc 59
1591
1592
1593
\section2 image-position
1594
\target image-position-prop
1595
\table
1596
\row \li \b Type \li \l{#Alignment}{alignment}
1597
\endtable
1598
1599
The alignment of the image's position can be specified using relative
1600
or absolute position.
1601
1602
\section2 left
1603
\target left-prop
1604
\table
1605
\row \li \b Type \li \l{#Length}{Length}
1606
\endtable
1607
1608
If \l{#position-prop}{position} is \c relative (the
1609
default), moves a subcontrol by a certain offset to
1610
the right.
1611
1612
If \l{#position-prop}{position} is \c absolute, the \c
1613
left property specifies the subcontrol's left edge in
1614
relation to the parent's left edge (see also
1615
\l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}).
1616
1617
If this property is not specified, it defaults to \c 0.
1618
1619
Example:
1620
1621
\snippet code/doc_src_stylesheet.qdoc 60
1622
1623
See also \l{#right-prop}{right}, \l{Qt Style Sheets Reference#top-prop}{top}, and
1624
\l{#bottom-prop}{bottom}.
1625
1626
\section2 letter-spacing
1627
\table
1628
\row \li \b Type \li \l{#Length}{Length}
1629
\endtable
1630
1631
Space between characters in a string within a widget.
1632
1633
\section2 lineedit-password-character*
1634
\target lineedit-password-character-prop
1635
\table
1636
\row \li \b Type \li \l{#Number}{Number}
1637
\endtable
1638
1639
The QLineEdit password character as a Unicode number.
1640
1641
If this property is not specified, it defaults to the
1642
value specified by the current style for the
1643
\l{QStyle::}{SH_LineEdit_PasswordCharacter} style hint.
1644
1645
Example:
1646
1647
\snippet code/doc_src_stylesheet.qdoc 61
1648
1649
1650
\section2 lineedit-password-mask-delay*
1651
\target lineedit-password-mask-delay-prop
1652
\table
1653
\row \li \b Type \li \l{#Number}{Number}
1654
\endtable
1655
1656
The QLineEdit password mask delay in milliseconds before
1657
\l{#lineedit-password-character-prop}{lineedit-password-character} is applied to visible character.
1658
1659
If this property is not specified, it defaults to the
1660
value specified by the current style for the
1661
\l{QStyle::}{SH_LineEdit_PasswordMaskDelay} style hint.
1662
1663
Available since Qt 5.4.
1664
1665
Example:
1666
1667
\snippet code/doc_src_stylesheet.qdoc 160
1668
1669
\section2 margin
1670
\target margin-prop
1671
\table
1672
\row \li \b Type \li \l {#Box Lengths}{Box Lengths}
1673
\endtable
1674
1675
The widget's margins. Equivalent to specifying \c
1676
margin-top, \c margin-right, \c margin-bottom, and \c
1677
margin-left.
1678
1679
This property is supported by QAbstractItemView
1680
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1681
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1682
QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
1683
and QToolTip.
1684
1685
If this property is not specified, it defaults to \c 0.
1686
1687
Example:
1688
1689
\snippet code/doc_src_stylesheet.qdoc 62
1690
1691
See also \l{Qt Style Sheets Reference#padding-prop}{padding},
1692
\l{#spacing-prop}{spacing}, and \l{The Box Model}.
1693
1694
\section2 margin-top
1695
\table
1696
\row \li \b Type \li \l{#Length}{Length}
1697
\endtable
1698
The widget's top margin.
1699
1700
\section2 margin-right
1701
\table
1702
\row \li \b Type \li \l{#Length}{Length}
1703
\endtable
1704
The widget's right margin.
1705
1706
\section2 margin-bottom
1707
\table
1708
\row \li \b Type \li \l{#Length}{Length}
1709
\endtable
1710
The widget's bottom margin.
1711
1712
\section2 margin-left
1713
\table
1714
\row \li \b Type \li \l{#Length}{Length}
1715
\endtable
1716
The widget's left margin.
1717
1718
\section2 max-height
1719
\target max-height-prop
1720
\table
1721
\row \li \b Type \li \l{#Length}{Length}
1722
\endtable
1723
1724
The widget's or a subcontrol's maximum height.
1725
1726
This property is supported by QAbstractItemView
1727
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1728
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1729
QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
1730
QSplitter, QStatusBar, QTextEdit, and QToolTip.
1731
1732
The value is relative to the contents rect in the \l{The
1733
Box Model}{box model}.
1734
1735
Example:
1736
1737
\snippet code/doc_src_stylesheet.qdoc 63
1738
1739
See also \l{#max-width-prop}{max-width}.
1740
1741
\section2 max-width
1742
\target max-width-prop
1743
\table
1744
\row \li \b Type \li \l{#Length}{Length}
1745
\endtable
1746
1747
The widget's or a subcontrol's maximum width.
1748
1749
This property is supported by QAbstractItemView
1750
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1751
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1752
QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
1753
QSplitter, QStatusBar, QTextEdit, and QToolTip.
1754
1755
The value is relative to the contents rect in the \l{The
1756
Box Model}{box model}.
1757
1758
Example:
1759
1760
\snippet code/doc_src_stylesheet.qdoc 64
1761
1762
See also \l{#max-height-prop}{max-height}.
1763
1764
\section2 messagebox-text-interaction-flags*
1765
\target messagebox-text-interaction-flags-prop
1766
\table
1767
\row \li \b Type \li \l{#Number}{Number}
1768
\endtable
1769
1770
The interaction behavior for text in a message box.
1771
Possible values are based on Qt::TextInteractionFlags.
1772
1773
If this property is not specified, it defaults to the
1774
value specified by the current style for the
1775
\l{QStyle::}{SH_MessageBox_TextInteractionFlags} style
1776
hint.
1777
1778
Example:
1779
1780
\snippet code/doc_src_stylesheet.qdoc 65
1781
1782
\section2 min-height
1783
\target min-height-prop
1784
\table
1785
\row \li \b Type \li \l{#Length}{Length}
1786
\endtable
1787
1788
The widget's or a subcontrol's minimum height.
1789
1790
This property is supported by QAbstractItemView
1791
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1792
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1793
QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
1794
QSplitter, QStatusBar, QTextEdit, QToolButton, and QToolTip.
1795
1796
If this property is not specified, the minimum height is
1797
derived based on the widget's contents and the style.
1798
1799
The value is relative to the contents rect in the \l{The
1800
Box Model}{box model}.
1801
1802
Example:
1803
1804
\snippet code/doc_src_stylesheet.qdoc 66
1805
1806
\note Setting this property might allow widgets to shrink
1807
smaller than the space required for the contents.
1808
1809
See also \l{#min-width-prop}{min-width}.
1810
1811
\section2 min-width
1812
\target min-width-prop
1813
\table
1814
\row \li \b Type \li \l{#Length}{Length}
1815
\endtable
1816
1817
The widget's or a subcontrol's minimum width.
1818
1819
This property is supported by QAbstractItemView
1820
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1821
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1822
QMenuBar, QPushButton, QRadioButton, QSizeGrip, QSpinBox,
1823
QSplitter, QStatusBar, QTextEdit, QToolButton, and QToolTip.
1824
1825
If this property is not specified, the minimum width is
1826
derived based on the widget's contents and the style.
1827
1828
The value is relative to the contents rect in the \l{The
1829
Box Model}{box model}.
1830
1831
Example:
1832
1833
\snippet code/doc_src_stylesheet.qdoc 67
1834
1835
\note Setting this property might allow widgets to shrink
1836
smaller than the space required for the contents.
1837
1838
See also \l{#min-height-prop}{min-height}.
1839
1840
\section2 opacity*
1841
\target opacity-prop
1842
\table
1843
\row \li \b Type \li \l{#Number}{Number}
1844
\endtable
1845
1846
The opacity for a widget. Possible values are from 0
1847
(transparent) to 255 (opaque). For the moment, this is
1848
only supported for \l{QToolTip}{tooltips}.
1849
1850
If this property is not specified, it defaults to the
1851
value specified by the current style for the
1852
\l{QStyle::}{SH_ToolTipLabel_Opacity} style hint.
1853
1854
Example:
1855
1856
\snippet code/doc_src_stylesheet.qdoc 68
1857
1858
\section2 outline
1859
1860
The outline drawn around the object's border.
1861
1862
\section2 outline-color
1863
\table
1864
\row \li \b Type \li \l{#Color}{Color}
1865
\endtable
1866
1867
The color of the outline.
1868
See also \l{Qt Style Sheets Reference#border-color-prop}{border-color}
1869
1870
\section2 outline-offset
1871
\table
1872
\row \li \b Type \li \l{#Length}{Length}
1873
\endtable
1874
1875
The outline's offset from the border of the widget.
1876
1877
\section2 outline-style
1878
1879
Specifies the pattern used to draw the outline.
1880
See also \l{Qt Style Sheets Reference#border-style-prop}{border-style}
1881
1882
\section2 outline-radius
1883
1884
Adds rounded corners to the outline.
1885
1886
\section2 outline-bottom-left-radius
1887
\table
1888
\row \li \b Type \li \l{#Radius}{Radius}
1889
\endtable
1890
1891
The radius for the bottom-left rounded corner of the outline.
1892
1893
\section2 outline-bottom-right-radius
1894
\table
1895
\row \li \b Type \li \l{#Radius}{Radius}
1896
\endtable
1897
1898
The radius for the bottom-right rounded corner of the outline.
1899
1900
\section2 outline-top-left-radius
1901
\table
1902
\row \li \b Type \li \l{#Radius}{Radius}
1903
\endtable
1904
1905
The radius for the top-left corner of the outline.
1906
1907
\section2 outline-top-right-radius
1908
\table
1909
\row \li \b Type \li \l{#Radius}{Radius}
1910
\endtable
1911
1912
The radius for the top-right rounded corner of the outline.
1913
1914
\section2 padding
1915
\target padding-prop
1916
\table
1917
\row \li \b Type \li \l{#Box Lengths}{Box Lengths}
1918
\endtable
1919
1920
The widget's padding. Equivalent to specifying \c
1921
padding-top, \c padding-right, \c padding-bottom, and \c
1922
padding-left.
1923
1924
This property is supported by QAbstractItemView
1925
subclasses, QAbstractSpinBox subclasses, QCheckBox,
1926
QComboBox, QFrame, QGroupBox, QLabel, QLineEdit, QMenu,
1927
QMenuBar, QPushButton, QRadioButton, QSplitter, QTextEdit,
1928
and QToolTip.
1929
1930
If this property is not specified, it defaults to \c 0.
1931
1932
Example:
1933
1934
\snippet code/doc_src_stylesheet.qdoc 69
1935
1936
See also \l{#margin-prop}{margin},
1937
\l{#spacing-prop}{spacing}, and \l{The Box Model}.
1938
1939
\section2 padding-top
1940
\table
1941
\row \li \b Type \li \l{#Length}{Length}
1942
\endtable
1943
1944
The widget's top padding.
1945
1946
\section2 padding-right
1947
\table
1948
\row \li \b Type \li \l{#Length}{Length}
1949
\endtable
1950
1951
The widget's right padding.
1952
1953
\section2 padding-bottom
1954
\table
1955
\row \li \b Type \li \l{#Length}{Length}
1956
\endtable
1957
1958
The widget's bottom padding.
1959
1960
\section2 padding-left
1961
\table
1962
\row \li \b Type \li \l{#Length}{Length}
1963
\endtable
1964
1965
The widget's left padding.
1966
1967
\section2 paint-alternating-row-colors-for-empty-area
1968
\target paint-alternating-row-colors-for-empty-area-prop
1969
\table
1970
\row \li \b Type \li \c bool
1971
\endtable
1972
1973
Whether the QTreeView paints alternating row colors for the empty
1974
area (i.e the area where there are no items)
1975
1976
\section2 placeholder-text-color*
1977
\target placeholder-text-color-prop
1978
\table
1979
\row \li \b Type \li \l{#Brush}{Brush} \br
1980
\endtable
1981
1982
The color used for the placeholder text of text editing widgets.
1983
1984
If this property is not set, the default value is whatever
1985
is set for the palette's \l{QPalette::}{PlaceholderText}
1986
role.
1987
1988
Example:
1989
1990
\snippet code/doc_src_stylesheet.qdoc 163
1991
1992
Available since 6.5.
1993
1994
\section2 position
1995
\target position-prop
1996
\table
1997
\row \li \b Type \li \c relative \br
1998
| \c absolute
1999
\endtable
2000
2001
Whether offsets specified using \l{Qt Style Sheets Reference#left-prop}{left},
2002
\l{#right-prop}{right}, \l{Qt Style Sheets Reference#top-prop}{top}, and
2003
\l{#bottom-prop}{bottom} are relative or absolute
2004
coordinates.
2005
2006
If this property is not specified, it defaults to \c
2007
relative.
2008
2009
\section2 right
2010
\target right-prop
2011
\table
2012
\row \li \b Type \li \l{#Length}{Length}
2013
\endtable
2014
2015
If \l{#position-prop}{position} is \c relative (the
2016
default), moves a subcontrol by a certain offset to
2017
the left; specifying \tt{right: \e{x}} is then equivalent
2018
to specifying \tt{\l{Qt Style Sheets Reference#left-prop}{left}: -\e{x}}.
2019
2020
If \l{#position-prop}{position} is \c absolute, the \c
2021
right property specifies the subcontrol's right edge in
2022
relation to the parent's right edge (see also
2023
\l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}).
2024
2025
Example:
2026
2027
\snippet code/doc_src_stylesheet.qdoc 70
2028
2029
See also \l{Qt Style Sheets Reference#left-prop}{left}, \l{Qt Style Sheets Reference#top-prop}{top}, and
2030
\l{#bottom-prop}{bottom}.
2031
2032
\section2 selection-background-color*
2033
\target selection-background-color-prop
2034
\table
2035
\row \li \b Type \li \l{#Brush}{Brush}
2036
\endtable
2037
2038
The background of selected text or items.
2039
2040
This property is supported by all widgets that respect
2041
the \l QWidget::palette and that show selection text.
2042
2043
If this property is not set, the default value is
2044
whatever is set for the palette's
2045
\l{QPalette::}{Highlight} role.
2046
2047
Example:
2048
2049
\snippet code/doc_src_stylesheet.qdoc 71
2050
2051
See also \l{#selection-color-prop}{selection-color} and
2052
\l{Qt Style Sheets Reference#background-prop}{background}.
2053
2054
2055
\section2 selection-color*
2056
\target selection-color-prop
2057
\table
2058
\row \li \b Type \li \l{#Brush}{Brush} \br
2059
\endtable
2060
2061
The foreground of selected text or items.
2062
2063
This property is supported by all widgets that respect
2064
the \l QWidget::palette and that show selection text.
2065
2066
If this property is not set, the default value is
2067
whatever is set for the palette's
2068
\l{QPalette::}{HighlightedText} role.
2069
2070
Example:
2071
2072
\snippet code/doc_src_stylesheet.qdoc 72
2073
2074
See also
2075
\l{#selection-background-color-prop}{selection-background-color}
2076
and \l{#color-prop}{color}.
2077
2078
2079
\section2 show-decoration-selected*
2080
\target show-decoration-selected-prop
2081
\table
2082
\row \li \b Type \li \l{#Boolean}{Boolean}
2083
\endtable
2084
2085
Controls whether selections in a QListView cover the
2086
entire row or just the extent of the text.
2087
2088
If this property is not specified, it defaults to the
2089
value specified by the current style for the
2090
\l{QStyle::}{SH_ItemView_ShowDecorationSelected} style
2091
hint.
2092
2093
Example:
2094
2095
\snippet code/doc_src_stylesheet.qdoc 73
2096
2097
\section2 spacing*
2098
\target spacing-prop
2099
\table
2100
\row \li \b Type \li \l{#Length}{Length}
2101
\endtable
2102
2103
Internal spacing in the widget.
2104
2105
This property is supported by QCheckBox, checkable
2106
\l{QGroupBox}es, QMenuBar, and QRadioButton.
2107
2108
If this property is not specified, the default value
2109
depends on the widget and on the current style.
2110
2111
Example:
2112
2113
\snippet code/doc_src_stylesheet.qdoc 74
2114
2115
See also \l{Qt Style Sheets Reference#padding-prop}{padding} and
2116
\l{#margin-prop}{margin}.
2117
2118
2119
\section2 subcontrol-origin*
2120
\target subcontrol-origin-prop
2121
\table
2122
\row \li \b Type \li \l{#Origin}{Origin}
2123
\endtable
2124
2125
The origin rectangle of the subcontrol within the
2126
parent element.
2127
2128
If this property is not specified, the default is \c
2129
padding.
2130
2131
Example:
2132
2133
\snippet code/doc_src_stylesheet.qdoc 75
2134
2135
See also
2136
\l{Qt Style Sheets Reference#subcontrol-position-prop}{subcontrol-position}.
2137
2138
\section2 subcontrol-position*
2139
\target subcontrol-position-prop
2140
\table
2141
\row \li \b Type \li \l{#Alignment}{Alignment}
2142
\endtable
2143
2144
The alignment of the subcontrol within the origin
2145
rectangle specified by \l{Qt Style Sheets Reference#subcontrol-origin-prop}
2146
{subcontrol-origin}.
2147
2148
If this property is not specified, it defaults to a value
2149
that depends on the subcontrol.
2150
2151
Example:
2152
2153
\snippet code/doc_src_stylesheet.qdoc 76
2154
2155
See also
2156
\l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}.
2157
2158
\section2 titlebar-show-tooltips-on-buttons
2159
\target titlebar-show-tooltips-on-buttons-prop
2160
\table
2161
\row \li \b Type \li \c bool
2162
\endtable
2163
2164
Whether tool tips are shown on window title bar buttons.
2165
2166
2167
\section2 widget-animation-duration*
2168
\target widget-animation-duration
2169
\table
2170
\row \li \b Type \li \l{#Number}{Number}
2171
\endtable
2172
2173
How much an animation should last (in milliseconds).
2174
A value equal to zero means that the animations will be disabled.
2175
2176
If this property is not specified, it defaults to the
2177
value specified by the current style for the
2178
\l{QStyle::}{SH_Widget_Animation_Duration} style hint.
2179
2180
Available since Qt 5.10.
2181
2182
Example:
2183
2184
\snippet code/doc_src_stylesheet.qdoc 162
2185
2186
\section2 text-align
2187
\target text-align-prop
2188
\table
2189
\row \li \b Type \li \l{#Alignment}{Alignment}
2190
\endtable
2191
2192
The alignment of text and icon within the contents of the widget.
2193
2194
If this value is not specified, it defaults to the value
2195
that depends on the native style.
2196
2197
Example:
2198
2199
\snippet code/doc_src_stylesheet.qdoc 77
2200
2201
This property is currently supported only by QPushButton
2202
and QProgressBar.
2203
2204
\section2 text-decoration
2205
\table
2206
\row \li \b Type
2207
\li \c none \br
2208
\c underline \br
2209
\c overline \br
2210
\c line-through
2211
\endtable
2212
2213
Additional text effects.
2214
2215
2216
\section2 top
2217
\target top-prop
2218
\table
2219
\row \li \b Type \li \l{#Length}{Length}
2220
\endtable
2221
2222
If \l{#position-prop}{position} is \c relative (the
2223
default), moves a subcontrol by a certain offset
2224
down.
2225
2226
If \l{#position-prop}{position} is \c absolute, the \c top
2227
property specifies the subcontrol's top edge in relation
2228
to the parent's top edge (see also
2229
\l{Qt Style Sheets Reference#subcontrol-origin-prop}{subcontrol-origin}).
2230
2231
If this property is not specified, it defaults to \c 0.
2232
2233
Example:
2234
2235
\snippet code/doc_src_stylesheet.qdoc 78
2236
2237
See also \l{Qt Style Sheets Reference#left-prop}{left}, \l{#right-prop}{right}, and
2238
\l{#bottom-prop}{bottom}.
2239
2240
\section2 width
2241
\target width-prop
2242
\table
2243
\row \li \b Type \li \l{#Length}{Length}
2244
\endtable
2245
2246
The width of a subcontrol (or a widget in some cases).
2247
2248
If this property is not specified, it defaults to a value
2249
that depends on the subcontrol/widget and on the current style.
2250
2251
\warning Unless otherwise specified, this property has no effect
2252
when set on widgets. If you want a widget with a fixed width, set
2253
the \l{#min-width-prop}{min-width} and
2254
\l{#max-width-prop}{max-width} to the same value.
2255
2256
Example:
2257
2258
\snippet code/doc_src_stylesheet.qdoc 79
2259
2260
See also \l{#height-prop}{height}.
2261
2262
\section2 word-spacing
2263
\table
2264
\row \li \b Type \li \l{#Length}{Length}
2265
\endtable
2266
2267
Space between each word in a string within a widget.
2268
2269
\section2 -qt-background-role
2270
\table
2271
\row \li \b Type \li \l{#paletterole}{PaletteRole}
2272
\endtable
2273
2274
The \c{background-color} for the subcontrol or widget based on the
2275
chosen role.
2276
2277
\section2 -qt-style-features
2278
\table
2279
\row \li \b Type \li \c list
2280
\endtable
2281
2282
The list of CSS properties that you want to apply Qt-specific styles on.
2283
2284
\note The \c list can only include properties that are not pixmap-based.
2285
2286
\target list of icons
2287
\section1 List of Icons
2288
2289
Icons used in Qt can be customized using the following properties. Each of
2290
the properties listed in this section have the type \l{#Icon}{Icon}.
2291
2292
Note that for icons to appear in buttons in a QDialogButtonBox, you need to
2293
set the dialogbuttonbox-buttons-have-icons property to true. Also, to
2294
customize the size of the icons, use the icon-size property.
2295
2296
\table 100%
2297
\header
2298
\li Name
2299
\li QStyle::StandardPixmap
2300
2301
\row
2302
\li backward-icon
2303
\li QStyle::SP_ArrowBack
2304
2305
\row
2306
\li cd-icon
2307
\li QStyle::SP_DriveCDIcon
2308
2309
\row
2310
\li computer-icon
2311
\li QStyle::SP_ComputerIcon
2312
2313
\row
2314
\li desktop-icon
2315
\li QStyle::SP_DesktopIcon
2316
2317
\row
2318
\li dialog-apply-icon
2319
\li QStyle::SP_DialogApplyButton
2320
2321
\row
2322
\li dialog-cancel-icon
2323
\li QStyle::SP_DialogCancelButton
2324
2325
\row
2326
\li dialog-close-icon
2327
\li QStyle::SP_DialogCloseButton
2328
2329
\row
2330
\li dialog-discard-icon
2331
\li QStyle::SP_DialogDiscardButton
2332
2333
\row
2334
\li dialog-help-icon
2335
\li QStyle::SP_DialogHelpButton
2336
2337
\row
2338
\li dialog-no-icon
2339
\li QStyle::SP_DialogNoButton
2340
2341
\row
2342
\li dialog-ok-icon
2343
\li QStyle::SP_DialogOkButton
2344
2345
\row
2346
\li dialog-open-icon
2347
\li QStyle::SP_DialogOpenButton
2348
2349
\row
2350
\li dialog-reset-icon
2351
\li QStyle::SP_DialogResetButton
2352
2353
\row
2354
\li dialog-save-icon
2355
\li QStyle::SP_DialogSaveButton
2356
2357
\row
2358
\li dialog-yes-icon
2359
\li QStyle::SP_DialogYesButton
2360
2361
\row
2362
\li directory-closed-icon
2363
\li QStyle::SP_DirClosedIcon
2364
2365
\row
2366
\li directory-icon
2367
\li QStyle::SP_DirIcon
2368
2369
\row
2370
\li directory-link-icon
2371
\li QStyle::SP_DirLinkIcon
2372
2373
\row
2374
\li directory-open-icon
2375
\li QStyle::SP_DirOpenIcon
2376
2377
\row
2378
\li dockwidget-close-icon
2379
\li QStyle::SP_DockWidgetCloseButton
2380
2381
\row
2382
\li downarrow-icon
2383
\li QStyle::SP_ArrowDown
2384
2385
\row
2386
\li dvd-icon
2387
\li QStyle::SP_DriveDVDIcon
2388
2389
\row
2390
\li file-icon
2391
\li QStyle::SP_FileIcon
2392
2393
\row
2394
\li file-link-icon
2395
\li QStyle::SP_FileLinkIcon
2396
2397
\omit
2398
\row
2399
\li filedialog-backward-icon
2400
\li QStyle::SP_FileDialogBack
2401
\endomit
2402
2403
\row
2404
\li filedialog-contentsview-icon
2405
\li QStyle::SP_FileDialogContentsView
2406
2407
\row
2408
\li filedialog-detailedview-icon
2409
\li QStyle::SP_FileDialogDetailedView
2410
2411
\row
2412
\li filedialog-end-icon
2413
\li QStyle::SP_FileDialogEnd
2414
2415
\row
2416
\li filedialog-infoview-icon
2417
\li QStyle::SP_FileDialogInfoView
2418
2419
\row
2420
\li filedialog-listview-icon
2421
\li QStyle::SP_FileDialogListView
2422
2423
\row
2424
\li filedialog-new-directory-icon
2425
\li QStyle::SP_FileDialogNewFolder
2426
2427
\row
2428
\li filedialog-parent-directory-icon
2429
\li QStyle::SP_FileDialogToParent
2430
2431
\row
2432
\li filedialog-start-icon
2433
\li QStyle::SP_FileDialogStart
2434
2435
\row
2436
\li floppy-icon
2437
\li QStyle::SP_DriveFDIcon
2438
2439
\row
2440
\li forward-icon
2441
\li QStyle::SP_ArrowForward
2442
2443
\row
2444
\li harddisk-icon
2445
\li QStyle::SP_DriveHDIcon
2446
2447
\row
2448
\li home-icon
2449
\li QStyle::SP_DirHomeIcon
2450
2451
\row
2452
\li lineedit-clear-button-icon
2453
\li QStyle::SP_LineEditClearButton
2454
2455
\row
2456
\li leftarrow-icon
2457
\li QStyle::SP_ArrowLeft
2458
2459
\row
2460
\li messagebox-critical-icon
2461
\li QStyle::SP_MessageBoxCritical
2462
2463
\row
2464
\li messagebox-information-icon
2465
\li QStyle::SP_MessageBoxInformation
2466
2467
\row
2468
\li messagebox-question-icon
2469
\li QStyle::SP_MessageBoxQuestion
2470
2471
\row
2472
\li messagebox-warning-icon
2473
\li QStyle::SP_MessageBoxWarning
2474
2475
\row
2476
\li network-icon
2477
\li QStyle::SP_DriveNetIcon
2478
2479
\row
2480
\li rightarrow-icon
2481
\li QStyle::SP_ArrowRight
2482
2483
\row
2484
\li titlebar-contexthelp-icon
2485
\li QStyle::SP_TitleBarContextHelpButton
2486
2487
\row
2488
\li titlebar-maximize-icon
2489
\li QStyle::SP_TitleBarMaxButton
2490
2491
\row
2492
\li titlebar-menu-icon
2493
\li QStyle::SP_TitleBarMenuButton
2494
2495
\row
2496
\li titlebar-minimize-icon
2497
\li QStyle::SP_TitleBarMinButton
2498
2499
\row
2500
\li titlebar-normal-icon
2501
\li QStyle::SP_TitleBarNormalButton
2502
2503
\row
2504
\li titlebar-shade-icon
2505
\li QStyle::SP_TitleBarShadeButton
2506
2507
\row
2508
\li titlebar-unshade-icon
2509
\li QStyle::SP_TitleBarUnshadeButton
2510
2511
\row
2512
\li trash-icon
2513
\li QStyle::SP_TrashIcon
2514
2515
\row
2516
\li uparrow-icon
2517
\li QStyle::SP_ArrowUp
2518
2519
\endtable
2520
2521
\section1 List of Property Types
2522
2523
The following table summarizes the syntax and meaning of the
2524
different property types.
2525
2526
\table 100%
2527
\header
2528
\li Type
2529
\li Syntax
2530
\li Description
2531
2532
\row
2533
\li \b Alignment \target Alignment
2534
\li \{ \c top \br
2535
| \c bottom \br
2536
| \c left \br
2537
| \c right \br
2538
| \c center \}*
2539
\li Horizontal and/or vertical alignment.
2540
2541
Example:
2542
2543
\snippet code/doc_src_stylesheet.qdoc 80
2544
2545
\row
2546
\li \b Attachment \target Attachment
2547
\li \{ \c scroll \br
2548
| \c fixed \}*
2549
\li Scroll or fixed attachment.
2550
2551
\row
2552
\li \b Background \target Background
2553
\li \{ \l{#Brush}{Brush} \br
2554
| \l{#Url}{Url} \br
2555
| \l{#Repeat}{Repeat} \br
2556
| \l{#Alignment}{Alignment} \}*
2557
\li A sequence of \l{#Brush}{Brush}, \l{#Url}{Url},
2558
\l{#Repeat}{Repeat}, and \l{#Alignment}{Alignment}.
2559
2560
\row
2561
\li \b Boolean \target Boolean
2562
\li 0 | 1
2563
\li True (\c 1) or false (\c 0).
2564
2565
Example:
2566
2567
\snippet code/doc_src_stylesheet.qdoc 81
2568
2569
\row
2570
\li \b Border \target Border
2571
\li \{ \l{#Border Style}{Border Style} \br
2572
| \l{#Length}{Length} \br
2573
| \l{#Brush}{Brush} \}*
2574
\li Shorthand border property.
2575
2576
\row
2577
\li \b{Border Image} \target Border Image
2578
\li \c none \br
2579
| \l{Url} \l{Number}\{4\} \br (\c stretch | \c repeat){0,2}
2580
\li A border image is an image that is composed of nine parts
2581
(top left, top center, top right, center left, center,
2582
center right, bottom left, bottom center, and bottom
2583
right). When a border of a certain size is required, the
2584
corner parts are used as is, and the top, right, bottom,
2585
and left parts are stretched or repeated to produce a
2586
border with the desired size.
2587
2588
See the
2589
\l{http://www.w3.org/TR/css3-background/#the-border-image}
2590
{CSS3 Draft Specification} for details.
2591
2592
\row
2593
\li \b{Border Style} \target Border Style
2594
\li \c dashed \br
2595
| \c dot-dash \br
2596
| \c dot-dot-dash \br
2597
| \c dotted \br
2598
| \c double \br
2599
| \c groove \br
2600
| \c inset \br
2601
| \c outset \br
2602
| \c ridge \br
2603
| \c solid \br
2604
| \c none
2605
\li Specifies the pattern used to draw a border.
2606
See the \l{http://www.w3.org/TR/css3-background/#border-style}
2607
{CSS3 Draft Specification} for details.
2608
2609
\row
2610
\li \b{Box Colors} \target Box Colors
2611
\li \l{#Brush}{Brush}\{1,4\}
2612
\li One to four occurrences of \l{#Brush}{Brush}, specifying the top,
2613
right, bottom, and left edges of a box, respectively. If
2614
the left color is not specified, it is taken to be the
2615
same as the right color. If the bottom color is not
2616
specified, it is taken to be the same as the top color. If
2617
the right color is not specified, it is taken to be the
2618
same as the top color.
2619
2620
Example:
2621
2622
\snippet code/doc_src_stylesheet.qdoc 82
2623
2624
\row
2625
\li \b{Box Lengths} \target Box Lengths
2626
\li \l{#Length}{Length}\{1,4\}
2627
\li One to four occurrences of \l{#Length}{Length}, specifying the
2628
top, right, bottom, and left edges of a box,
2629
respectively. If the left length is not specified, it is
2630
taken to be the same as the right length. If the bottom
2631
length is not specified, is it taken to be the same as the
2632
top length. If the right length is not specified, it is
2633
taken to be the same as the top length.
2634
2635
Examples:
2636
2637
\snippet code/doc_src_stylesheet.qdoc 83
2638
2639
\row
2640
\li \b{Brush} \target Brush
2641
\li \l{#Color}{Color} \br
2642
| \l{Gradient} \br
2643
| \l{PaletteRole}
2644
\li Specifies a Color or a Gradient or an entry in the Palette.
2645
2646
\row
2647
\li \b{Color} \target Color
2648
\li \tt{rgb(\e{r}, \e{g}, \e{b})} \br
2649
| \tt{rgba(\e{r}, \e{g}, \e{b}, \e{a})} \br
2650
| \tt{hsv(\e{h}, \e{s}, \e{v})} \br
2651
| \tt{hsva(\e{h}, \e{s}, \e{v}, \e{a})} \br
2652
| \tt{hsl(\e{h}, \e{s}, \e{l})} \br
2653
| \tt{hsla(\e{h}, \e{s}, \e{l}, \e{a})} \br
2654
| \tt{#\e{rrggbb}} \br
2655
| \l{QColor::fromString()}{Color Name} \br
2656
\li Specifies a color as RGB (red, green, blue), RGBA (red,
2657
green, blue, alpha), HSV (hue, saturation, value), HSVA
2658
(hue, saturation, value, alpha), HSL (hue, saturation,
2659
lightness), HSLA (hue, saturation, lightness, alpha) or a
2660
named color. The \c rgb() or \c rgba() syntax can be used
2661
with integer values between 0 and 255, or with percentages.
2662
The value of s, v, l and a in \c hsv(), \c hsva() \c hsl()
2663
or \c hsla() must all be in the range 0-255 or with
2664
percentages, the value of h must be in the range 0-359.
2665
The support for HSL(A) is available since 5.13.
2666
2667
Examples:
2668
2669
\snippet code/doc_src_stylesheet.qdoc 84
2670
2671
\note The RGB colors allowed are the same as those allowed with
2672
CSS 2.1, as listed
2673
\l{http://www.w3.org/TR/CSS21/syndata.html#color-units}{here}.
2674
2675
\row
2676
\li \b{Font} \target Font
2677
\li (\l{#Font Style}{Font Style} | \l{#Font Weight}{Font Weight}){0,2} \l{#Font Size}{Font Size} String
2678
\li Shorthand font property.
2679
2680
\row
2681
\li \b{Font Size} \target Font Size
2682
\li \l{Length}
2683
\li The size of a font.
2684
2685
\row
2686
\li \b{Font Style} \target Font Style
2687
\li \c normal \br
2688
| \c italic \br
2689
| \c oblique
2690
\li The style of a font.
2691
2692
\row
2693
\li \b{Font Weight} \target Font Weight
2694
\li \c normal \br
2695
| \c bold \br
2696
| \c 100 \br
2697
| \c 200 \br
2698
... \br
2699
| \c 900
2700
\li The weight of a font.
2701
2702
\row
2703
\li \b{Gradient} \target Gradient
2704
\li \c qlineargradient \br
2705
| \c qradialgradient \br
2706
| \c qconicalgradient
2707
\li Specifies gradient fills. There are three types of gradient fills:
2708
2709
\list
2710
\li \e{Linear} gradients interpolate colors between start and
2711
end points.
2712
\li \e{Radial} gradients interpolate colors between a focal
2713
point and end points on a circle surrounding it.
2714
\li \e{Conical} gradients interpolate colors around a center
2715
point.
2716
\endlist
2717
2718
Gradients are specified in Object Bounding Mode. Imagine the box
2719
in which the gradient is rendered, to have its top left corner at (0, 0)
2720
and its bottom right corner at (1, 1). Gradient parameters are
2721
then specified as percentages from 0 to 1. These values are
2722
extrapolated to actual box coordinates at runtime. It is possible
2723
specify values that lie outside the bounding box (-0.6 or 1.8, for
2724
instance).
2725
2726
\warning The stops have to appear sorted in ascending order.
2727
2728
Examples:
2729
2730
\snippet code/doc_src_stylesheet.qdoc 85
2731
2732
\row
2733
\li \b{Icon} \target Icon
2734
\li (\l{#Url}{Url} (\c disabled | \c active | \c normal | \c selected)?
2735
(\c on | \c off)? )*
2736
\li A list of url, QIcon::Mode and QIcon::State.
2737
2738
Example:
2739
\snippet code/doc_src_stylesheet.qdoc 86
2740
2741
\row
2742
\li \b{Length} \target Length
2743
\li \l{#Number}{Number} (\c px | \c pt | \c em | \c ex)?
2744
\li A number followed by a measurement unit. The CSS standard recommends
2745
that user agents must
2746
\l{http://www.w3.org/TR/CSS21/syndata.html#illegalvalues}{ignore}
2747
a declaration with an illegal value. In Qt, it is mandatory to
2748
specify measurement units. For compatibility with earlier versions
2749
of Qt, numbers without measurement units are treated as pixels
2750
in most contexts. The supported units are:
2751
2752
\list
2753
\li \c px: pixels
2754
\li \c pt: the size of one point (i.e., 1/72 of an inch)
2755
\li \c em: the size relative to the font size of the element
2756
(e.g., 2em means 2 times the size of the font)
2757
\li \c ex: the x-height of the font (i.e., the height of 'x')
2758
\endlist
2759
2760
However, Qt is limited to font sizes in \c pt and \c px and any other
2761
size must be in \c px, \c em or \c ex.
2762
2763
\row
2764
\li \b{Number} \target Number
2765
\li A decimal integer or a real number
2766
\li Examples: \c 0, \c 18, \c +127, \c -255, \c 12.34, \c -.5,
2767
\c 0009.
2768
2769
\row
2770
\li \b{Origin} \target Origin
2771
\li \c margin \br
2772
| \c border \br
2773
| \c padding \br
2774
| \c content
2775
\li Indicates which of four rectangles to use.
2776
2777
\list
2778
\li \c margin: The margin rectangle. The margin falls outside the border.
2779
\li \c border: The border rectangle. This is where any border is drawn.
2780
\li \c padding: The padding rectangle. Unlike the margins,
2781
padding is located inside the border.
2782
\li \c content: The content rectangle. This specifies where
2783
the actual contents go, excluding any
2784
padding, border, or margin.
2785
\endlist
2786
2787
See also \l{The Box Model}.
2788
2789
\row
2790
\li \b{PaletteRole} \target PaletteRole
2791
\li \c alternate-base \br
2792
| \c accent \br
2793
| \c base \br
2794
| \c bright-text \br
2795
| \c button \br
2796
| \c button-text \br
2797
| \c dark \br
2798
| \c highlight \br
2799
| \c highlighted-text \br
2800
| \c light \br
2801
| \c link \br
2802
| \c link-visited \br
2803
| \c mid \br
2804
| \c midlight \br
2805
| \c placeholder-text \br
2806
| \c shadow \br
2807
| \c text \br
2808
| \c tooltip-base \br
2809
| \c tooltip-text \br
2810
| \c window \br
2811
| \c window-text \br
2812
\li These values correspond the \l{QPalette::ColorRole}{Color roles}
2813
in the widget's QPalette.
2814
2815
For example,
2816
\snippet code/doc_src_stylesheet.qdoc 87
2817
2818
\row
2819
\li \b{Radius} \target Radius
2820
\li \l{#Length}{Length}\{1, 2\}
2821
\li One or two occurrences of \l{#Length}{Length}. If only one length is
2822
specified, it is used as the radius of the quarter circle
2823
defining the corner. If two lengths are specified, the
2824
first length is the horizontal radius of a quarter
2825
ellipse, whereas the second length is the vertical radius.
2826
2827
\row
2828
\li \b{Repeat} \target Repeat
2829
\li \c repeat-x \br
2830
| \c repeat-y \br
2831
| \c repeat \br
2832
| \c no-repeat
2833
\li A value indicating the nature of repetition.
2834
2835
\list
2836
\li \c repeat-x: Repeat horizontally.
2837
\li \c repeat-y: Repeat vertically.
2838
\li \c repeat: Repeat horizontally and vertically.
2839
\li \c no-repeat: Don't repeat.
2840
\endlist
2841
2842
\row
2843
\li \b{Url} \target Url
2844
\li \tt{url(\e{filename})}
2845
\li \tt{\e{filename}} is the name of a file on the local disk
2846
or stored using \l{The Qt Resource System}. Setting an
2847
image implicitly sets the width and height of the element.
2848
2849
\endtable
2850
2851
\section1 List of Pseudo-States
2852
2853
The following pseudo-states are supported:
2854
2855
\table 100%
2856
\header
2857
\li Pseudo-State
2858
\li Description
2859
2860
\row \li \c :active \target active
2861
\li This state is set when the widget resides in an active window.
2862
2863
\row
2864
\li \c :adjoins-item \target adjoins-item-ps
2865
\li This state is set when the \l{#branch-sub}{::branch} of a QTreeView
2866
is adjacent to an item.
2867
2868
\row
2869
\li \c :alternate \target alternate-ps
2870
\li This state is set for every alternate row whe painting the row of
2871
a QAbstractItemView when QAbstractItemView::alternatingRowColors()
2872
is set to true.
2873
2874
\row
2875
\li \c :bottom \target bottom-ps
2876
\li The item is positioned at the bottom. For example, a QTabBar
2877
that has its tabs positioned at the bottom.
2878
2879
\row
2880
\li \c :checked \target checked-ps
2881
\li The item is checked. For example, the
2882
\l{QAbstractButton::checked}{checked} state of QAbstractButton.
2883
2884
\row
2885
\li \c :closable \target closable-ps
2886
\li The items can be closed. For example, the QDockWidget has the
2887
QDockWidget::DockWidgetClosable feature turned on.
2888
2889
\row
2890
\li \c :closed \target closed-ps
2891
\li The item is in the closed state. For example, an non-expanded
2892
item in a QTreeView
2893
2894
\row
2895
\li \c :default \target default-ps
2896
\li The item is the default. For example, a
2897
\l{QPushButton::default}{default} QPushButton or a default action
2898
in a QMenu.
2899
2900
\row
2901
\li \c :disabled \target disabled-ps
2902
\li The item is \l{QWidget::enabled}{disabled}.
2903
2904
\row
2905
\li \c :editable \target editable-ps
2906
\li The QComboBox is editable.
2907
2908
\row
2909
\li \c :enabled \target enabled-ps
2910
\li The item is \l{QWidget::enabled}{enabled}.
2911
2912
\row
2913
\li \c :exclusive \target exclusive-ps
2914
\li The item is part of an exclusive item group. For example, a menu
2915
item in a exclusive QActionGroup.
2916
2917
\row
2918
\li \c :first \target first-ps
2919
\li The item is the first (in a list). For example, the first
2920
tab in a QTabBar.
2921
2922
\row
2923
\li \c :flat \target flat-ps
2924
\li The item is flat. For example, a
2925
\l{QPushButton::flat}{flat} QPushButton.
2926
2927
\row
2928
\li \c :floatable \target floatable-ps
2929
\li The items can be floated. For example, the QDockWidget has the
2930
QDockWidget::DockWidgetFloatable feature turned on.
2931
2932
\row
2933
\li \c :focus \target focus-ps
2934
\li The item has \l{QWidget::hasFocus()}{input focus}.
2935
2936
\row
2937
\li \c :has-children \target has-children-ps
2938
\li The item has children. For example, an item in a
2939
QTreeView that has child items.
2940
2941
\row
2942
\li \c :has-siblings \target has-siblings-ps
2943
\li The item has siblings. For example, an item in a
2944
QTreeView that siblings.
2945
2946
\row
2947
\li \c :horizontal \target horizontal-ps
2948
\li The item has horizontal orientation
2949
2950
\row
2951
\li \c :hover \target hover-ps
2952
\li The mouse is hovering over the item.
2953
2954
\row
2955
\li \c :indeterminate \target indeterminate-ps
2956
\li The item has indeterminate state. For example, a QCheckBox
2957
or QRadioButton is \l{Qt::PartiallyChecked}{partially checked}.
2958
2959
\row
2960
\li \c :last \target last-ps
2961
\li The item is the last (in a list). For example, the last
2962
tab in a QTabBar.
2963
2964
\row
2965
\li \c :left \target left-ps
2966
\li The item is positioned at the left. For example, a QTabBar
2967
that has its tabs positioned at the left.
2968
2969
\row
2970
\li \c :maximized \target maximized-ps
2971
\li The item is maximized. For example, a maximized QMdiSubWindow.
2972
2973
\row
2974
\li \c :middle \target middle-ps
2975
\li The item is in the middle (in a list). For example, a tab
2976
that is not in the beginning or the end in a QTabBar.
2977
2978
\row
2979
\li \c :minimized \target minimized-ps
2980
\li The item is minimized. For example, a minimized QMdiSubWindow.
2981
2982
\row
2983
\li \c :movable \target movable-ps
2984
\li The item can be moved around. For example, the QDockWidget has the
2985
QDockWidget::DockWidgetMovable feature turned on.
2986
2987
\row
2988
\li \c :no-frame \target no-frame-ps
2989
\li The item has no frame. For example, a frameless QSpinBox
2990
or QLineEdit.
2991
2992
\row
2993
\li \c :non-exclusive \target non-exclusive-ps
2994
\li The item is part of a non-exclusive item group. For example, a menu
2995
item in a non-exclusive QActionGroup.
2996
2997
\row
2998
\li \c :off \target off-ps
2999
\li For items that can be toggled, this applies to items
3000
in the "off" state.
3001
3002
\row
3003
\li \c :on \target on-ps
3004
\li For items that can be toggled, this applies to widgets
3005
in the "on" state.
3006
3007
\row
3008
\li \c :only-one \target only-one-ps
3009
\li The item is the only one (in a list). For example, a lone tab
3010
in a QTabBar.
3011
3012
\row
3013
\li \c :open \target open-ps
3014
\li The item is in the open state. For example, an expanded
3015
item in a QTreeView, or a QComboBox or QPushButton with
3016
an open menu.
3017
3018
\row
3019
\li \c :next-selected \target next-selected-ps
3020
\li The next item (in a list) is selected. For example, the
3021
selected tab of a QTabBar is next to this item.
3022
3023
\row
3024
\li \c :pressed \target pressed-ps
3025
\li The item is being pressed using the mouse.
3026
3027
\row
3028
\li \c :previous-selected \target previous-selected-ps
3029
\li The previous item (in a list) is selected. For example, a
3030
tab in a QTabBar that is next to the selected tab.
3031
3032
\row
3033
\li \c :read-only \target read-only-ps
3034
\li The item is marked read only or non-editable. For example,
3035
a read only QLineEdit or a non-editable QComboBox.
3036
3037
\row
3038
\li \c :right \target right-ps
3039
\li The item is positioned at the right. For example, a QTabBar
3040
that has its tabs positioned at the right.
3041
3042
\row
3043
\li \c :selected \target selected-ps
3044
\li The item is selected. For example, the selected tab in
3045
a QTabBar or the selected item in a QMenu.
3046
3047
\row
3048
\li \c :top \target top-ps
3049
\li The item is positioned at the top. For example, a QTabBar
3050
that has its tabs positioned at the top.
3051
3052
\row
3053
\li \c :unchecked \target unchecked-ps
3054
\li The item is
3055
\l{QAbstractButton::checked}{unchecked}.
3056
3057
\row
3058
\li \c :vertical \target vertical-ps
3059
\li The item has vertical orientation.
3060
3061
\row
3062
\li \c :window \target window-ps
3063
\li The widget is a window (i.e top level widget)
3064
3065
\endtable
3066
3067
\target subcontrols
3068
\section1 List of Sub-Controls
3069
3070
The following subcontrols are available:
3071
3072
\table 100%
3073
\header
3074
\li Sub-Control
3075
\li Description
3076
3077
\row
3078
\li \c ::add-line \target add-line-sub
3079
\li The button to add a line of a QScrollBar.
3080
3081
\row
3082
\li \c ::add-page \target add-page-sub
3083
\li The region between the handle (slider) and the \l{#add-line-sub}{add-line}
3084
of a QScrollBar.
3085
3086
\row
3087
\li \c ::branch \target branch-sub
3088
\li The branch indicator of a QTreeView.
3089
3090
\row
3091
\li \c ::chunk \target chunk-sub
3092
\li The progress chunk of a QProgressBar.
3093
3094
\row
3095
\li \c ::close-button \target close-button-sub
3096
\li The close button of a QDockWidget or tabs of QTabBar
3097
3098
\row
3099
\li \c ::corner \target corner-sub
3100
\li The corner between two scrollbars in a QAbstractScrollArea
3101
3102
\row
3103
\li \c ::down-arrow \target down-arrow-sub
3104
\li The down arrow of a QComboBox, QHeaderView (sort indicator),
3105
QScrollBar or QSpinBox.
3106
3107
\row
3108
\li \c ::down-button \target down-button-sub
3109
\li The down button of a QScrollBar or a QSpinBox.
3110
3111
\row
3112
\li \c ::drop-down \target drop-down-sub
3113
\li The drop-down button of a QComboBox.
3114
3115
\row
3116
\li \c ::float-button \target float-button-sub
3117
\li The float button of a QDockWidget
3118
3119
\row
3120
\li \c ::groove \target groove-sub
3121
\li The groove of a QSlider.
3122
3123
\row
3124
\li \c ::indicator \target indicator-sub
3125
\li The indicator of a QAbstractItemView, a QCheckBox, a QRadioButton,
3126
a checkable QMenu item or a checkable QGroupBox.
3127
3128
\row
3129
\li \c ::handle \target handle-sub
3130
\li The handle (slider) of a QScrollBar, a QSplitter, or a QSlider.
3131
3132
\row
3133
\li \c ::icon \target icon-sub
3134
\li The icon of a QAbstractItemView or a QMenu.
3135
3136
\row
3137
\li \c ::item \target item-sub
3138
\li An item of a QAbstractItemView, a QMenuBar, a QMenu, or
3139
a QStatusBar.
3140
3141
\row
3142
\li \c ::left-arrow \target left-arrow-sub
3143
\li The left arrow of a QScrollBar.
3144
3145
\row
3146
\li \c ::left-corner \target left-corner-sub
3147
\li The left corner of a QTabWidget. For example, this control can be
3148
used to control position the left corner widget in a QTabWidget.
3149
3150
\row
3151
\li \c ::menu-arrow \target menu-arrow-sub
3152
\li The arrow of a QToolButton with a menu.
3153
3154
\row
3155
\li \c ::menu-button \target menu-button-sub
3156
\li The menu button of a QToolButton.
3157
3158
\row
3159
\li \c ::menu-indicator \target menu-indicator-sub
3160
\li The menu indicator of a QPushButton.
3161
3162
\row
3163
\li \c ::right-arrow \target right-arrow-sub
3164
\li The right arrow of a QMenu or a QScrollBar.
3165
3166
\row
3167
\li \c ::pane \target pane-sub
3168
\li The pane (frame) of a QTabWidget.
3169
3170
\row
3171
\li \c ::right-corner \target right-corner-sub
3172
\li The right corner of a QTabWidget. For example, this control can be
3173
used to control the position the right corner widget in a QTabWidget.
3174
3175
\row
3176
\li \c ::scroller \target scroller-sub
3177
\li The scroller of a QMenu or QTabBar.
3178
3179
\row
3180
\li \c ::section \target section-sub
3181
\li The section of a QHeaderView.
3182
3183
\row
3184
\li \c ::separator \target separator-sub
3185
\li The separator of a QMenu or in a QMainWindow.
3186
3187
\row
3188
\li \c ::sub-line \target sub-line-sub
3189
\li The button to subtract a line of a QScrollBar.
3190
3191
\row
3192
\li \c ::sub-page \target sub-page-sub
3193
\li The region between the handle (slider) and the \l{#sub-line-sub}{sub-line}
3194
of a QScrollBar.
3195
3196
\row
3197
\li \c ::tab \target tab-sub
3198
\li The tab of a QTabBar or QToolBox.
3199
3200
\row
3201
\li \c ::tab-bar \target tab-bar-sub
3202
\li The tab bar of a QTabWidget. This subcontrol exists only to
3203
control the position of the QTabBar inside the QTabWidget. To
3204
style the tabs using the \l{#tab-sub}{::tab} subcontrol.
3205
3206
\row
3207
\li \c ::tear \target tear-sub
3208
\li The tear indicator of a QTabBar.
3209
3210
\row
3211
\li \c ::tearoff \target tearoff-sub
3212
\li The tear-off indicator of a QMenu.
3213
3214
\row
3215
\li \c ::text \target text-ps
3216
\li The text of a QAbstractItemView.
3217
3218
\row
3219
\li \c ::title \target title-sub
3220
\li The title of a QGroupBox or a QDockWidget.
3221
3222
\row
3223
\li \c ::up-arrow \target up-arrow-sub
3224
\li The up arrow of a QHeaderView (sort indicator), QScrollBar
3225
or a QSpinBox.
3226
3227
\row
3228
\li \c ::up-button \target up-button-sub
3229
\li The up button of a QSpinBox.
3230
3231
\endtable
3232
3233
See \l{Customizing the QPushButton's Menu Indicator Sub-Control}
3234
for an example of how to customize a subcontrol.
3235
*/
qtbase
src
widgets
doc
src
widgets-and-layouts
stylesheet-reference.qdoc
Generated on
for Qt by
1.16.1