Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
doc_src_stylesheet.qdoc
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4//! [0]
5QLineEdit { background: yellow }
6QCheckBox { color: red }
7//! [0]
8
9
10//! [1]
11QPushButton { color: red }
12//! [1]
13
14
15//! [2]
16QPushButton, QLineEdit, QComboBox { color: red }
17//! [2]
18
19
20//! [3]
21QPushButton { color: red }
22QLineEdit { color: red }
23QComboBox { color: red }
24//! [3]
25
26
27//! [4]
28QPushButton { color: red; background-color: white }
29//! [4]
30
31
32//! [5]
33QComboBox::drop-down { image: url(dropdown.png) }
34//! [5]
35
36
37//! [6]
38QComboBox {
39 margin-right: 20px;
40}
41QComboBox::drop-down {
42 subcontrol-origin: margin;
43}
44//! [6]
45
46
47//! [7]
48QComboBox::down-arrow {
49 image: url(down_arrow.png);
50}
51QComboBox::down-arrow:pressed {
52 position: relative;
53 top: 1px; left: 1px;
54}
55//! [7]
56
57
58//! [8]
59QPushButton:hover { color: white }
60//! [8]
61
62
63//! [9]
64QRadioButton:!hover { color: red }
65//! [9]
66
67
68//! [10]
69QCheckBox:hover:checked { color: white }
70//! [10]
71
72
73//! [11]
74QPushButton:hover:!pressed { color: blue; }
75//! [11]
76
77
78//! [12]
79QCheckBox:hover, QCheckBox:checked { color: white }
80//! [12]
81
82
83//! [13]
84QComboBox::drop-down:hover { image: url(dropdown_bright.png) }
85//! [13]
86
87
88//! [14]
89QPushButton#okButton { color: gray }
90QPushButton { color: red }
91//! [14]
92
93
94//! [15]
95QPushButton:hover { color: white }
96QPushButton { color: red }
97//! [15]
98
99
100//! [16]
101QPushButton:hover { color: white }
102QPushButton:enabled { color: red }
103//! [16]
104
105
106//! [17]
107QPushButton:enabled { color: red }
108QPushButton:hover { color: white }
109//! [17]
110
111
112//! [18]
113QPushButton:hover:enabled { color: white }
114QPushButton:enabled { color: red }
115//! [18]
116
117
118//! [19]
119QPushButton { color: red }
120QAbstractButton { color: gray }
121//! [19]
122
123
124//! [20]
125* {} /* a=0 b=0 c=0 -> specificity = 0 */
126LI {} /* a=0 b=0 c=1 -> specificity = 1 */
127UL LI {} /* a=0 b=0 c=2 -> specificity = 2 */
128UL OL+LI {} /* a=0 b=0 c=3 -> specificity = 3 */
129H1 + *[REL=up]{} /* a=0 b=1 c=1 -> specificity = 11 */
130UL OL LI.red {} /* a=0 b=1 c=3 -> specificity = 13 */
131LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */
132#x34y {} /* a=1 b=0 c=0 -> specificity = 100 */
133//! [20]
134
135
136//! [28]
137MyLabel { qproperty-pixmap: url(pixmap.png); }
138MyGroupBox { qproperty-titleColor: rgb(100, 200, 100); }
139QPushButton { qproperty-iconSize: 20px 20px; }
140//! [28]
141
142
143//! [30]
144QPushButton { background-color: red; border: none; }
145//! [30]
146
147
148//! [31]
149QToolButton { background-color: red; border: none; }
150//! [31]
151
152
153//! [33]
154QTreeView {
155 alternate-background-color: blue;
156 background: yellow;
157}
158//! [33]
159
160
161//! [34]
162QTextEdit { background: yellow }
163//! [34]
164
165
166//! [35]
167QLabel {
168 background-image: url(dense6pattern.png);
169 background-repeat: repeat-xy;
170}
171//! [35]
172
173
174//! [36]
175QLabel { background-color: yellow }
176QLineEdit { background-color: rgb(255, 0, 0) }
177//! [36]
178
179
180//! [37]
181QFrame { background-image: url(:/images/hydro.png) }
182//! [37]
183
184
185//! [38]
186QFrame {
187 background: white url(:/images/ring.png);
188 background-repeat: repeat-y;
189 background-position: left;
190}
191//! [38]
192
193
194//! [39]
195QFrame {
196 background: url(:/images/footer.png);
197 background-position: bottom left;
198}
199//! [39]
200
201
202//! [40]
203QTextEdit {
204 background-image: url("leaves.png");
205 background-attachment: fixed;
206}
207//! [40]
208
209
210//! [41]
211QFrame {
212 background-image: url(:/images/header.png);
213 background-position: top left;
214 background-origin: content;
215 background-clip: padding;
216}
217//! [41]
218
219
220//! [42]
221QFrame {
222 background-image: url(:/images/header.png);
223 background-position: top left;
224 background-origin: content;
225}
226//! [42]
227
228
229//! [43]
230QLineEdit { border: 1px solid white }
231//! [43]
232
233
234//! [44]
235QLineEdit {
236 border-width: 1px;
237 border-style: solid;
238 border-color: white;
239}
240//! [44]
241
242
243//! [45]
244QLineEdit {
245 border-width: 1px;
246 border-style: solid;
247 border-radius: 4px;
248}
249//! [45]
250
251
252//! [46]
253QLineEdit {
254 border-width: 1px;
255 border-style: solid;
256 border-color: blue;
257}
258//! [46]
259
260
261//! [47]
262QLineEdit {
263 border-width: 2px;
264 border-style: solid;
265 border-color: darkblue;
266}
267//! [47]
268
269
270//! [48]
271QSpinBox::down-button { bottom: 2px }
272//! [48]
273
274
275//! [49]
276* { button-layout: 2 }
277//! [49]
278
279
280//! [50]
281QPushButton { color: red }
282//! [50]
283
284
285//! [51]
286QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; }
287//! [51]
288
289
290//! [52]
291* { etch-disabled-text: 1 }
292//! [52]
293
294
295//! [53]
296QCheckBox { font: bold italic large "Times New Roman" }
297//! [53]
298
299
300//! [54]
301QCheckBox { font-family: "New Century Schoolbook" }
302//! [54]
303
304
305//! [55]
306QTextEdit { font-size: 12px }
307//! [55]
308
309
310//! [56]
311QTextEdit { font-style: italic }
312//! [56]
313
314
315//! [57]
316* { gridline-color: gray }
317//! [57]
318
319
320//! [58]
321QSpinBox::down-button { height: 10px }
322//! [58]
323
324
325//! [59]
326// implicitly sets the size of down-button to the
327// size of spindown.png
328QSpinBox::down-button { image: url(:/images/spindown.png) }
329//! [59]
330
331
332//! [60]
333QSpinBox::down-button { left: 2px }
334//! [60]
335
336
337//! [61]
338* { lineedit-password-character: 9679 }
339//! [61]
340
341
342//! [62]
343QLineEdit { margin: 2px }
344//! [62]
345
346
347//! [63]
348QSpinBox { max-height: 24px }
349//! [63]
350
351
352//! [64]
353QComboBox { max-width: 72px }
354//! [64]
355
356
357//! [65]
358QMessageBox { messagebox-text-interaction-flags: 5 }
359//! [65]
360
361
362//! [66]
363QComboBox { min-height: 24px }
364//! [66]
365
366
367//! [67]
368QComboBox { min-width: 72px }
369//! [67]
370
371
372//! [68]
373QToolTip { opacity: 223 }
374//! [68]
375
376
377//! [69]
378QLineEdit { padding: 3px }
379//! [69]
380
381
382//! [70]
383QSpinBox::down-button { right: 2px }
384//! [70]
385
386
387//! [71]
388QTextEdit { selection-background-color: darkblue }
389//! [71]
390
391
392//! [72]
393QTextEdit { selection-color: white }
394//! [72]
395
396
397//! [73]
398* { show-decoration-selected: 1 }
399//! [73]
400
401
402//! [74]
403QMenuBar { spacing: 10 }
404//! [74]
405
406
407//! [75]
408QSpinBox::up-button {
409 image: url(:/images/spinup.png);
410 subcontrol-origin: content;
411 subcontrol-position: right top;
412}
413//! [75]
414
415
416//! [76]
417QSpinBox::down-button {
418 image: url(:/images/spindown.png);
419 subcontrol-origin: padding;
420 subcontrol-position: right bottom;
421}
422//! [76]
423
424
425//! [77]
426QPushButton {
427 text-align: left;
428}
429//! [77]
430
431
432//! [78]
433QSpinBox::up-button { top: 2px }
434//! [78]
435
436
437//! [79]
438QSpinBox::up-button { width: 12px }
439//! [79]
440
441
442//! [80]
443QTextEdit { background-position: bottom center }
444//! [80]
445
446
447//! [81]
448QDialog { etch-disabled-text: 1 }
449//! [81]
450
451
452//! [82]
453QLabel { border-color: red } /* red red red red */
454QLabel { border-color: red blue } /* red blue red blue */
455QLabel { border-color: red blue green } /* red blue green blue */
456QLabel { border-color: red blue green yellow }
457/* red blue green yellow */
458//! [82]
459
460
461//! [83]
462QLabel { border-width: 1px } /* 1px 1px 1px 1px */
463QLabel { border-width: 1px 2px } /* 1px 2px 1px 2px */
464QLabel { border-width: 1px 2px 3px } /* 1px 2px 3px 2px */
465QLabel { border-width: 1px 2px 3px 4px } /* 1px 2px 3px 4px */
466//! [83]
467
468
469//! [84]
470QLabel { border-color: red } /* opaque red */
471QLabel { border-color: #FF0000 } /* opaque red */
472QLabel { border-color: rgba(255, 0, 0, 75%) } /* 75% opaque red */
473QLabel { border-color: rgb(255, 0, 0) } /* opaque red */
474QLabel { border-color: rgb(100%, 0%, 0%) } /* opaque red */
475QLabel { border-color: hsv(60, 100%, 100%) } /* opaque yellow */
476QLabel { border-color: hsva(240, 255, 255, 75%) } /* 75% blue */
477QLabel { border-color: hsl(60, 100%, 50%) } /* opaque yellow */
478QLabel { border-color: hsla(240, 255, 50%, 75%) } /* 75% blue */
479//! [84]
480
481
482//! [85]
483/* linear gradient from white to green */
484QTextEdit {
485 background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
486 stop:0 white, stop: 0.4 gray, stop:1 green)
487}
488
489/* linear gradient from white to green */
490QTextEdit {
491 background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
492 stop:0 white, stop: 0.4 rgba(10, 20, 30, 40),
493 stop:1 rgb(0, 200, 230, 200))
494}
495
496
497/* conical gradient from white to green */
498QTextEdit {
499 background: qconicalgradient(cx:0.5, cy:0.5, angle:30,
500 stop:0 white, stop:1 #00FF00)
501}
502
503/* radial gradient from white to green */
504QTextEdit {
505 background: qradialgradient(cx:0, cy:0, radius: 1,
506 fx:0.5, fy:0.5, stop:0 white, stop:1 green)
507}
508//! [85]
509
510
511//! [86]
512* {
513 file-icon: url(file.png),
514 url(file_selected.png) selected;
515 }
516
517QMessageBox {
518 dialogbuttonbox-buttons-have-icons: true;
519 dialog-ok-icon: url(ok.svg);
520 dialog-cancel-icon: url(cancel.png),
521 url(grayed_cancel.png) disabled;
522}
523//! [86]
524
525
526//! [87]
527QPushButton { color: palette(dark); }
528//! [87]
529
530
531//! [94]
532*[mandatoryField="true"] { background-color: yellow }
533//! [94]
534
535
536//! [96]
537QPushButton#evilButton { background-color: red }
538//! [96]
539
540
541//! [97]
542QPushButton#evilButton {
543 background-color: red;
544 border-style: outset;
545 border-width: 2px;
546 border-color: beige;
547}
548//! [97]
549
550
551//! [98]
552QPushButton#evilButton {
553 background-color: red;
554 border-style: outset;
555 border-width: 2px;
556 border-radius: 10px;
557 border-color: beige;
558 font: bold 14px;
559 min-width: 10em;
560 padding: 6px;
561}
562//! [98]
563
564
565//! [99]
566QPushButton#evilButton {
567 background-color: red;
568 border-style: outset;
569 border-width: 2px;
570 border-radius: 10px;
571 border-color: beige;
572 font: bold 14px;
573 min-width: 10em;
574 padding: 6px;
575}
576QPushButton#evilButton:pressed {
577 background-color: rgb(224, 0, 0);
578 border-style: inset;
579}
580//! [99]
581
582
583//! [100]
584QPushButton#evilButton::menu-indicator {
585 image: url(myindicator.png);
586}
587//! [100]
588
589
590//! [101]
591QPushButton::menu-indicator {
592 image: url(myindicator.png);
593 subcontrol-position: right center;
594 subcontrol-origin: padding;
595 left: -2px;
596}
597//! [101]
598
599
600//! [102]
601QLineEdit { color: red }
602//! [102]
603
604
605//! [103]
606QLineEdit { color: red }
607QLineEdit[readOnly="true"] { color: gray }
608//! [103]
609
610
611//! [104]
612QLineEdit { color: red }
613QLineEdit[readOnly="true"] { color: gray }
614#registrationDialog QLineEdit { color: brown }
615//! [104]
616
617
618//! [105]
619QLineEdit { color: red }
620QLineEdit[readOnly="true"] { color: gray }
621QDialog QLineEdit { color: brown }
622//! [105]
623
624
625//! [106]
626QTextEdit, QListView {
627 background-color: white;
628 background-image: url(draft.png);
629 background-attachment: scroll;
630}
631//! [106]
632
633
634//! [107]
635QTextEdit, QListView {
636 background-color: white;
637 background-image: url(draft.png);
638 background-attachment: fixed;
639}
640//! [107]
641
642
643//! [108]
644QCheckBox {
645 spacing: 5px;
646}
647
648QCheckBox::indicator {
649 width: 13px;
650 height: 13px;
651}
652
653QCheckBox::indicator:unchecked {
654 image: url(:/images/checkbox_unchecked.png);
655}
656
657QCheckBox::indicator:unchecked:hover {
658 image: url(:/images/checkbox_unchecked_hover.png);
659}
660
661QCheckBox::indicator:unchecked:pressed {
662 image: url(:/images/checkbox_unchecked_pressed.png);
663}
664
665QCheckBox::indicator:checked {
666 image: url(:/images/checkbox_checked.png);
667}
668
669QCheckBox::indicator:checked:hover {
670 image: url(:/images/checkbox_checked_hover.png);
671}
672
673QCheckBox::indicator:checked:pressed {
674 image: url(:/images/checkbox_checked_pressed.png);
675}
676
677QCheckBox::indicator:indeterminate:hover {
678 image: url(:/images/checkbox_indeterminate_hover.png);
679}
680
681QCheckBox::indicator:indeterminate:pressed {
682 image: url(:/images/checkbox_indeterminate_pressed.png);
683}
684//! [108]
685
686
687//! [109]
688QComboBox {
689 border: 1px solid gray;
690 border-radius: 3px;
691 padding: 1px 18px 1px 3px;
692 min-width: 6em;
693}
694
695QComboBox:editable {
696 background: white;
697}
698
699QComboBox:!editable, QComboBox::drop-down:editable {
700 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
701 stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
702 stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
703}
704
705/* QComboBox gets the "on" state when the popup is open */
706QComboBox:!editable:on, QComboBox::drop-down:editable:on {
707 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
708 stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,
709 stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);
710}
711
712QComboBox:on { /* shift the text when the popup opens */
713 padding-top: 3px;
714 padding-left: 4px;
715}
716
717QComboBox::drop-down {
718 subcontrol-origin: padding;
719 subcontrol-position: top right;
720 width: 15px;
721
722 border-left-width: 1px;
723 border-left-color: darkgray;
724 border-left-style: solid; /* just a single line */
725 border-top-right-radius: 3px; /* same radius as the QComboBox */
726 border-bottom-right-radius: 3px;
727}
728
729QComboBox::down-arrow {
730 image: url(/usr/share/icons/crystalsvg/16x16/actions/1downarrow.png);
731}
732
733QComboBox::down-arrow:on { /* shift the arrow when popup is open */
734 top: 1px;
735 left: 1px;
736}
737//! [109]
738
739
740//! [110]
741QComboBox QAbstractItemView {
742 border: 2px solid darkgray;
743 selection-background-color: lightgray;
744}
745//! [110]
746
747
748//! [111]
749QDockWidget {
750 border: 1px solid lightgray;
751 titlebar-close-icon: url(close.png);
752 titlebar-normal-icon: url(undock.png);
753}
754
755QDockWidget::title {
756 text-align: left; /* align the text to the left */
757 background: lightgray;
758 padding-left: 5px;
759}
760
761QDockWidget::close-button, QDockWidget::float-button {
762 border: 1px solid transparent;
763 background: darkgray;
764 padding: 0px;
765}
766
767QDockWidget::close-button:hover, QDockWidget::float-button:hover {
768 background: gray;
769}
770
771QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
772 padding: 1px -1px -1px 1px;
773}
774//! [111]
775
776
777//! [112]
778QDockWidget {
779 border: 1px solid lightgray;
780 titlebar-close-icon: url(close.png);
781 titlebar-normal-icon: url(float.png);
782}
783
784QDockWidget::title {
785 text-align: left;
786 background: lightgray;
787 padding-left: 35px;
788}
789
790QDockWidget::close-button, QDockWidget::float-button {
791 background: darkgray;
792 padding: 0px;
793 icon-size: 14px; /* maximum icon size */
794}
795
796QDockWidget::close-button:hover, QDockWidget::float-button:hover {
797 background: gray;
798}
799
800QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
801 padding: 1px -1px -1px 1px;
802}
803
804QDockWidget::close-button {
805 subcontrol-position: top left;
806 subcontrol-origin: margin;
807 position: absolute;
808 top: 0px; left: 0px; bottom: 0px;
809 width: 14px;
810}
811
812QDockWidget::float-button {
813 subcontrol-position: top left;
814 subcontrol-origin: margin;
815 position: absolute;
816 top: 0px; left: 16px; bottom: 0px;
817 width: 14px;
818}
819//! [112]
820
821
822//! [113]
823QFrame, QLabel, QToolTip {
824 border: 2px solid green;
825 border-radius: 4px;
826 padding: 2px;
827 background-image: url(images/welcome.png);
828}
829//! [113]
830
831
832//! [114]
833QGroupBox {
834 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
835 stop: 0 #E0E0E0, stop: 1 #FFFFFF);
836 border: 2px solid gray;
837 border-radius: 5px;
838 margin-top: 1ex; /* leave space at the top for the title */
839}
840
841QGroupBox::title {
842 subcontrol-origin: margin;
843 subcontrol-position: top center; /* position at the top center */
844 padding: 0 3px;
845 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
846 stop: 0 #FF0ECE, stop: 1 #FFFFFF);
847}
848//! [114]
849
850
851//! [115]
852QGroupBox::indicator {
853 width: 13px;
854 height: 13px;
855}
856
857QGroupBox::indicator:unchecked {
858 image: url(:/images/checkbox_unchecked.png);
859}
860
861/* proceed with styling just like QCheckBox */
862//! [115]
863
864
865//! [116]
866QHeaderView::section {
867 background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
868 stop:0 #616161, stop: 0.5 #505050,
869 stop: 0.6 #434343, stop:1 #656565);
870 color: white;
871 padding-left: 4px;
872 border: 1px solid #6c6c6c;
873}
874
875QHeaderView::section:checked
876{
877 background-color: red;
878}
879
880/* style the sort indicator */
881QHeaderView::down-arrow {
882 image: url(down_arrow.png);
883}
884
885QHeaderView::up-arrow {
886 image: url(up_arrow.png);
887}
888//! [116]
889
890
891//! [117]
892QLineEdit {
893 border: 2px solid gray;
894 border-radius: 10px;
895 padding: 0 8px;
896 background: yellow;
897 selection-background-color: darkgray;
898}
899//! [117]
900
901
902//! [118]
903QLineEdit[echoMode="2"] {
904 lineedit-password-character: 9679;
905}
906//! [118]
907
908
909//! [119]
910QLineEdit:read-only {
911 background: lightblue;
912}
913//! [119]
914
915
916//! [120]
917QListView {
918 alternate-background-color: yellow;
919}
920//! [120]
921
922
923//! [121]
924QListView {
925 show-decoration-selected: 1; /* make the selection span the entire width of the view */
926}
927
928QListView::item:alternate {
929 background: #EEEEEE;
930}
931
932QListView::item:selected {
933 border: 1px solid #6a6ea9;
934}
935
936QListView::item:selected:!active {
937 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
938 stop: 0 #ABAFE5, stop: 1 #8588B2);
939}
940
941QListView::item:selected:active {
942 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
943 stop: 0 #6a6ea9, stop: 1 #888dd9);
944}
945
946QListView::item:hover {
947 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
948 stop: 0 #FAFBFE, stop: 1 #DCDEF1);
949}
950//! [121]
951
952
953//! [122]
954QMainWindow::separator {
955 background: yellow;
956 width: 10px; /* when vertical */
957 height: 10px; /* when horizontal */
958}
959
960QMainWindow::separator:hover {
961 background: red;
962}
963//! [122]
964
965
966//! [123]
967QMenu {
968 background-color: #ABABAB; /* sets background of the menu */
969 border: 1px solid black;
970}
971
972QMenu::item {
973 /* sets background of menu item. set this to something non-transparent
974 if you want menu color and menu item color to be different */
975 background-color: transparent;
976}
977
978QMenu::item:selected { /* when user selects item using mouse or keyboard */
979 background-color: #654321;
980}
981//! [123]
982
983
984//! [124]
985QMenu {
986 background-color: white;
987 margin: 2px; /* some spacing around the menu */
988}
989
990QMenu::item {
991 padding: 2px 25px 2px 20px;
992 border: 1px solid transparent; /* reserve space for selection border */
993}
994
995QMenu::item:selected {
996 border-color: darkblue;
997 background: rgba(100, 100, 100, 150);
998}
999
1000QMenu::icon:checked { /* appearance of a 'checked' icon */
1001 background: gray;
1002 border: 1px inset gray;
1003 position: absolute;
1004 top: 1px;
1005 right: 1px;
1006 bottom: 1px;
1007 left: 1px;
1008}
1009
1010QMenu::separator {
1011 height: 2px;
1012 background: lightblue;
1013 margin-left: 10px;
1014 margin-right: 5px;
1015}
1016
1017QMenu::indicator {
1018 width: 13px;
1019 height: 13px;
1020}
1021
1022/* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */
1023QMenu::indicator:non-exclusive:unchecked {
1024 image: url(:/images/checkbox_unchecked.png);
1025}
1026
1027QMenu::indicator:non-exclusive:unchecked:selected {
1028 image: url(:/images/checkbox_unchecked_hover.png);
1029}
1030
1031QMenu::indicator:non-exclusive:checked {
1032 image: url(:/images/checkbox_checked.png);
1033}
1034
1035QMenu::indicator:non-exclusive:checked:selected {
1036 image: url(:/images/checkbox_checked_hover.png);
1037}
1038
1039/* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */
1040QMenu::indicator:exclusive:unchecked {
1041 image: url(:/images/radiobutton_unchecked.png);
1042}
1043
1044QMenu::indicator:exclusive:unchecked:selected {
1045 image: url(:/images/radiobutton_unchecked_hover.png);
1046}
1047
1048QMenu::indicator:exclusive:checked {
1049 image: url(:/images/radiobutton_checked.png);
1050}
1051
1052QMenu::indicator:exclusive:checked:selected {
1053 image: url(:/images/radiobutton_checked_hover.png);
1054}
1055
1056//! [124]
1057
1058
1059//! [125]
1060QMenuBar {
1061 background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
1062 stop:0 lightgray, stop:1 darkgray);
1063 spacing: 3px; /* spacing between menu bar items */
1064}
1065
1066QMenuBar::item {
1067 padding: 1px 4px;
1068 background: transparent;
1069 border-radius: 4px;
1070}
1071
1072QMenuBar::item:selected { /* when selected using mouse or keyboard */
1073 background: #a8a8a8;
1074}
1075
1076QMenuBar::item:pressed {
1077 background: #888888;
1078}
1079//! [125]
1080
1081
1082//! [126]
1083QProgressBar {
1084 border: 2px solid grey;
1085 border-radius: 5px;
1086}
1087
1088QProgressBar::chunk {
1089 background-color: #05B8CC;
1090 width: 20px;
1091}
1092//! [126]
1093
1094
1095//! [127]
1096QProgressBar {
1097 border: 2px solid grey;
1098 border-radius: 5px;
1099 text-align: center;
1100}
1101//! [127]
1102
1103
1104//! [128]
1105QProgressBar::chunk {
1106 background-color: #CD96CD;
1107 width: 10px;
1108 margin: 0.5px;
1109}
1110//! [128]
1111
1112
1113//! [129]
1114QPushButton {
1115 border: 2px solid #8f8f91;
1116 border-radius: 6px;
1117 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1118 stop: 0 #f6f7fa, stop: 1 #dadbde);
1119 min-width: 80px;
1120}
1121
1122QPushButton:pressed {
1123 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1124 stop: 0 #dadbde, stop: 1 #f6f7fa);
1125}
1126
1127QPushButton:flat {
1128 border: none; /* no border for a flat push button */
1129}
1130
1131QPushButton:default {
1132 border-color: navy; /* make the default button prominent */
1133}
1134//! [129]
1135
1136
1137//! [130]
1138QPushButton:open { /* when the button has its menu open */
1139 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1140 stop: 0 #dadbde, stop: 1 #f6f7fa);
1141}
1142
1143QPushButton::menu-indicator {
1144 image: url(menu_indicator.png);
1145 subcontrol-origin: padding;
1146 subcontrol-position: bottom right;
1147}
1148
1149QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open {
1150 position: relative;
1151 top: 2px; left: 2px; /* shift the arrow by 2 px */
1152}
1153//! [130]
1154
1155
1156//! [131]
1157QRadioButton::indicator {
1158 width: 13px;
1159 height: 13px;
1160}
1161
1162QRadioButton::indicator::unchecked {
1163 image: url(:/images/radiobutton_unchecked.png);
1164}
1165
1166QRadioButton::indicator:unchecked:hover {
1167 image: url(:/images/radiobutton_unchecked_hover.png);
1168}
1169
1170QRadioButton::indicator:unchecked:pressed {
1171 image: url(:/images/radiobutton_unchecked_pressed.png);
1172}
1173
1174QRadioButton::indicator::checked {
1175 image: url(:/images/radiobutton_checked.png);
1176}
1177
1178QRadioButton::indicator:checked:hover {
1179 image: url(:/images/radiobutton_checked_hover.png);
1180}
1181
1182QRadioButton::indicator:checked:pressed {
1183 image: url(:/images/radiobutton_checked_pressed.png);
1184}
1185//! [131]
1186
1187
1188//! [132]
1189QScrollBar:horizontal {
1190 border: 2px solid grey;
1191 background: #32CC99;
1192 height: 15px;
1193 margin: 0px 20px 0 20px;
1194}
1195//! [132]
1196
1197
1198//! [133]
1199QScrollBar::handle:horizontal {
1200 background: white;
1201 min-width: 20px;
1202}
1203//! [133]
1204
1205
1206//! [134]
1207QScrollBar::add-line:horizontal {
1208 border: 2px solid grey;
1209 background: #32CC99;
1210 width: 20px;
1211 subcontrol-position: right;
1212 subcontrol-origin: margin;
1213}
1214
1215QScrollBar::sub-line:horizontal {
1216 border: 2px solid grey;
1217 background: #32CC99;
1218 width: 20px;
1219 subcontrol-position: left;
1220 subcontrol-origin: margin;
1221}
1222//! [134]
1223
1224
1225//! [135]
1226QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {
1227 border: 2px solid grey;
1228 width: 3px;
1229 height: 3px;
1230 background: white;
1231}
1232
1233QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
1234 background: none;
1235}
1236//! [135]
1237
1238
1239//! [136]
1240QScrollBar:horizontal {
1241 border: 2px solid green;
1242 background: cyan;
1243 height: 15px;
1244 margin: 0px 40px 0 0px;
1245}
1246
1247QScrollBar::handle:horizontal {
1248 background: gray;
1249 min-width: 20px;
1250}
1251
1252QScrollBar::add-line:horizontal {
1253 background: blue;
1254 width: 16px;
1255 subcontrol-position: right;
1256 subcontrol-origin: margin;
1257 border: 2px solid black;
1258}
1259
1260QScrollBar::sub-line:horizontal {
1261 background: magenta;
1262 width: 16px;
1263 subcontrol-position: top right;
1264 subcontrol-origin: margin;
1265 border: 2px solid black;
1266 position: absolute;
1267 right: 20px;
1268}
1269
1270QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {
1271 width: 3px;
1272 height: 3px;
1273 background: pink;
1274}
1275
1276QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
1277 background: none;
1278}
1279
1280//! [136]
1281
1282
1283//! [137]
1284 QScrollBar:vertical {
1285 border: 2px solid grey;
1286 background: #32CC99;
1287 width: 15px;
1288 margin: 22px 0 22px 0;
1289 }
1290 QScrollBar::handle:vertical {
1291 background: white;
1292 min-height: 20px;
1293 }
1294 QScrollBar::add-line:vertical {
1295 border: 2px solid grey;
1296 background: #32CC99;
1297 height: 20px;
1298 subcontrol-position: bottom;
1299 subcontrol-origin: margin;
1300 }
1301
1302 QScrollBar::sub-line:vertical {
1303 border: 2px solid grey;
1304 background: #32CC99;
1305 height: 20px;
1306 subcontrol-position: top;
1307 subcontrol-origin: margin;
1308 }
1309 QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
1310 border: 2px solid grey;
1311 width: 3px;
1312 height: 3px;
1313 background: white;
1314 }
1315
1316 QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
1317 background: none;
1318 }
1319//! [137]
1320
1321
1322//! [138]
1323QSizeGrip {
1324 image: url(:/images/sizegrip.png);
1325 width: 16px;
1326 height: 16px;
1327}
1328//! [138]
1329
1330
1331//! [139]
1332QSlider::groove:horizontal {
1333 border: 1px solid #999999;
1334 height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
1335 background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
1336 margin: 2px 0;
1337}
1338
1339QSlider::handle:horizontal {
1340 background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
1341 border: 1px solid #5c5c5c;
1342 width: 18px;
1343 margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
1344 border-radius: 3px;
1345}
1346//! [139]
1347
1348
1349//! [140]
1350QSlider::groove:vertical {
1351 background: red;
1352 position: absolute; /* absolutely position 4px from the left and right of the widget. setting margins on the widget should work too... */
1353 left: 4px; right: 4px;
1354}
1355
1356QSlider::handle:vertical {
1357 height: 10px;
1358 background: green;
1359 margin: 0 -4px; /* expand outside the groove */
1360}
1361
1362QSlider::add-page:vertical {
1363 background: white;
1364}
1365
1366QSlider::sub-page:vertical {
1367 background: pink;
1368}
1369//! [140]
1370
1371
1372//! [141]
1373QSpinBox {
1374 padding-right: 15px; /* make room for the arrows */
1375 border-image: url(:/images/frame.png) 4;
1376 border-width: 3;
1377}
1378
1379QSpinBox::up-button {
1380 subcontrol-origin: border;
1381 subcontrol-position: top right; /* position at the top right corner */
1382
1383 width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */
1384 border-image: url(:/images/spinup.png) 1;
1385 border-width: 1px;
1386}
1387
1388QSpinBox::up-button:hover {
1389 border-image: url(:/images/spinup_hover.png) 1;
1390}
1391
1392QSpinBox::up-button:pressed {
1393 border-image: url(:/images/spinup_pressed.png) 1;
1394}
1395
1396QSpinBox::up-arrow {
1397 image: url(:/images/up_arrow.png);
1398 width: 7px;
1399 height: 7px;
1400}
1401
1402QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off { /* off state when value is max */
1403 image: url(:/images/up_arrow_disabled.png);
1404}
1405
1406QSpinBox::down-button {
1407 subcontrol-origin: border;
1408 subcontrol-position: bottom right; /* position at bottom right corner */
1409
1410 width: 16px;
1411 border-image: url(:/images/spindown.png) 1;
1412 border-width: 1px;
1413 border-top-width: 0;
1414}
1415
1416QSpinBox::down-button:hover {
1417 border-image: url(:/images/spindown_hover.png) 1;
1418}
1419
1420QSpinBox::down-button:pressed {
1421 border-image: url(:/images/spindown_pressed.png) 1;
1422}
1423
1424QSpinBox::down-arrow {
1425 image: url(:/images/down_arrow.png);
1426 width: 7px;
1427 height: 7px;
1428}
1429
1430QSpinBox::down-arrow:disabled,
1431QSpinBox::down-arrow:off { /* off state when value in min */
1432 image: url(:/images/down_arrow_disabled.png);
1433}
1434
1435//! [141]
1436
1437
1438//! [142]
1439QSplitter::handle {
1440 image: url(images/splitter.png);
1441}
1442
1443QSplitter::handle:horizontal {
1444 width: 2px;
1445}
1446
1447QSplitter::handle:vertical {
1448 height: 2px;
1449}
1450
1451QSplitter::handle:pressed {
1452 url(images/splitter_pressed.png);
1453}
1454
1455//! [142]
1456
1457
1458//! [143]
1459QStatusBar {
1460 background: brown;
1461}
1462
1463QStatusBar::item {
1464 border: 1px solid red;
1465 border-radius: 3px;
1466}
1467//! [143]
1468
1469
1470//! [144]
1471QStatusBar QLabel {
1472 border: 3px solid white;
1473}
1474//! [144]
1475
1476
1477//! [145]
1478QTabWidget::pane { /* The tab widget frame */
1479 border-top: 2px solid #C2C7CB;
1480}
1481
1482QTabWidget::tab-bar {
1483 left: 5px; /* move to the right by 5px */
1484}
1485
1486/* Style the tab using the tab sub-control. Note that
1487 it reads QTabBar _not_ QTabWidget */
1488QTabBar::tab {
1489 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1490 stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
1491 stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
1492 border: 2px solid #C4C4C3;
1493 border-bottom-color: #C2C7CB; /* same as the pane color */
1494 border-top-left-radius: 4px;
1495 border-top-right-radius: 4px;
1496 min-width: 8ex;
1497 padding: 2px;
1498}
1499
1500QTabBar::tab:selected, QTabBar::tab:hover {
1501 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1502 stop: 0 #fafafa, stop: 0.4 #f4f4f4,
1503 stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
1504}
1505
1506QTabBar::tab:selected {
1507 border-color: #9B9B9B;
1508 border-bottom-color: #C2C7CB; /* same as pane color */
1509}
1510
1511QTabBar::tab:!selected {
1512 margin-top: 2px; /* make non-selected tabs look smaller */
1513}
1514//! [145]
1515
1516
1517//! [146]
1518QTabWidget::pane { /* The tab widget frame */
1519 border-top: 2px solid #C2C7CB;
1520}
1521
1522QTabWidget::tab-bar {
1523 left: 5px; /* move to the right by 5px */
1524}
1525
1526/* Style the tab using the tab sub-control. Note that
1527 it reads QTabBar _not_ QTabWidget */
1528QTabBar::tab {
1529 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1530 stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
1531 stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
1532 border: 2px solid #C4C4C3;
1533 border-bottom-color: #C2C7CB; /* same as the pane color */
1534 border-top-left-radius: 4px;
1535 border-top-right-radius: 4px;
1536 min-width: 8ex;
1537 padding: 2px;
1538}
1539
1540QTabBar::tab:selected, QTabBar::tab:hover {
1541 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1542 stop: 0 #fafafa, stop: 0.4 #f4f4f4,
1543 stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
1544}
1545
1546QTabBar::tab:selected {
1547 border-color: #9B9B9B;
1548 border-bottom-color: #C2C7CB; /* same as pane color */
1549}
1550
1551QTabBar::tab:!selected {
1552 margin-top: 2px; /* make non-selected tabs look smaller */
1553}
1554
1555/* make use of negative margins for overlapping tabs */
1556QTabBar::tab:selected {
1557 /* expand/overlap to the left and right by 4px */
1558 margin-left: -4px;
1559 margin-right: -4px;
1560}
1561
1562QTabBar::tab:first:selected {
1563 margin-left: 0; /* the first selected tab has nothing to overlap with on the left */
1564}
1565
1566QTabBar::tab:last:selected {
1567 margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
1568}
1569
1570QTabBar::tab:only-one {
1571 margin: 0; /* if there is only one tab, we don't want overlapping margins */
1572}
1573//! [146]
1574
1575
1576//! [147]
1577QTabWidget::pane { /* The tab widget frame */
1578 border-top: 2px solid #C2C7CB;
1579 position: absolute;
1580 top: -0.5em;
1581}
1582
1583QTabWidget::tab-bar {
1584 alignment: center;
1585}
1586
1587/* Style the tab using the tab sub-control. Note that
1588 it reads QTabBar _not_ QTabWidget */
1589QTabBar::tab {
1590 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1591 stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
1592 stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
1593 border: 2px solid #C4C4C3;
1594 border-bottom-color: #C2C7CB; /* same as the pane color */
1595 border-top-left-radius: 4px;
1596 border-top-right-radius: 4px;
1597 min-width: 8ex;
1598 padding: 2px;
1599}
1600
1601QTabBar::tab:selected, QTabBar::tab:hover {
1602 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1603 stop: 0 #fafafa, stop: 0.4 #f4f4f4,
1604 stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
1605}
1606
1607QTabBar::tab:selected {
1608 border-color: #9B9B9B;
1609 border-bottom-color: #C2C7CB; /* same as pane color */
1610}
1611//! [147]
1612
1613
1614//! [148]
1615QTabBar::tear {
1616 image: url(tear_indicator.png);
1617}
1618
1619QTabBar::scroller { /* the width of the scroll buttons */
1620 width: 20px;
1621}
1622
1623QTabBar QToolButton { /* the scroll buttons are tool buttons */
1624 border-image: url(scrollbutton.png) 2;
1625 border-width: 2px;
1626}
1627
1628QTabBar QToolButton::right-arrow { /* the arrow mark in the tool buttons */
1629 image: url(rightarrow.png);
1630}
1631
1632QTabBar QToolButton::left-arrow {
1633 image: url(leftarrow.png);
1634}
1635//! [148]
1636
1637
1638//! [149]
1639QTableView {
1640 selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,
1641 stop: 0 #FF92BB, stop: 1 white);
1642}
1643//! [149]
1644
1645
1646//! [150]
1647QTableView QTableCornerButton::section {
1648 background: red;
1649 border: 2px outset red;
1650}
1651//! [150]
1652
1653
1654//! [151]
1655QToolBar {
1656 background: red;
1657 spacing: 3px; /* spacing between items in the tool bar */
1658}
1659
1660QToolBar::handle {
1661 image: url(handle.png);
1662}
1663//! [151]
1664
1665
1666//! [152]
1667QToolBox::tab {
1668 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1669 stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
1670 stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
1671 border-radius: 5px;
1672 color: darkgray;
1673}
1674
1675QToolBox::tab:selected { /* italicize selected tabs */
1676 font: italic;
1677 color: white;
1678}
1679//! [152]
1680
1681
1682//! [153]
1683QToolButton { /* all types of tool button */
1684 border: 2px solid #8f8f91;
1685 border-radius: 6px;
1686 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1687 stop: 0 #f6f7fa, stop: 1 #dadbde);
1688}
1689
1690QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
1691 padding-right: 20px; /* make way for the popup button */
1692}
1693
1694QToolButton:pressed {
1695 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
1696 stop: 0 #dadbde, stop: 1 #f6f7fa);
1697}
1698
1699/* the subcontrols below are used only in the MenuButtonPopup mode */
1700QToolButton::menu-button {
1701 border: 2px solid gray;
1702 border-top-right-radius: 6px;
1703 border-bottom-right-radius: 6px;
1704 /* 16px width + 4px for border = 20px allocated above */
1705 width: 16px;
1706}
1707
1708QToolButton::menu-arrow {
1709 image: url(downarrow.png);
1710}
1711
1712QToolButton::menu-arrow:open {
1713 top: 1px; left: 1px; /* shift it a bit */
1714}
1715//! [153]
1716
1717
1718//! [154]
1719QToolTip {
1720 border: 2px solid darkkhaki;
1721 padding: 5px;
1722 border-radius: 3px;
1723 opacity: 200;
1724}
1725//! [154]
1726
1727
1728//! [155]
1729QTreeView {
1730 alternate-background-color: yellow;
1731}
1732//! [155]
1733
1734
1735//! [156]
1736QTreeView {
1737 show-decoration-selected: 1;
1738}
1739
1740QTreeView::item {
1741 border: 1px solid #d9d9d9;
1742 border-top-color: transparent;
1743 border-bottom-color: transparent;
1744}
1745
1746QTreeView::item:hover {
1747 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
1748 border: 1px solid #bfcde4;
1749}
1750
1751QTreeView::item:selected {
1752 border: 1px solid #567dbc;
1753}
1754
1755QTreeView::item:selected:active{
1756 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
1757}
1758
1759QTreeView::item:selected:!active {
1760 background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
1761}
1762//! [156]
1763
1764
1765//! [157]
1766QTreeView::branch {
1767 background: palette(base);
1768}
1769
1770QTreeView::branch:has-siblings:!adjoins-item {
1771 background: cyan;
1772}
1773
1774QTreeView::branch:has-siblings:adjoins-item {
1775 background: red;
1776}
1777
1778QTreeView::branch:!has-children:!has-siblings:adjoins-item {
1779 background: blue;
1780}
1781
1782QTreeView::branch:closed:has-children:has-siblings {
1783 background: pink;
1784}
1785
1786QTreeView::branch:has-children:!has-siblings:closed {
1787 background: gray;
1788}
1789
1790QTreeView::branch:open:has-children:has-siblings {
1791 background: magenta;
1792}
1793
1794QTreeView::branch:open:has-children:!has-siblings {
1795 background: green;
1796}
1797
1798//! [157]
1799
1800
1801//! [158]
1802QTreeView::branch:has-siblings:!adjoins-item {
1803 border-image: url(vline.png) 0;
1804}
1805
1806QTreeView::branch:has-siblings:adjoins-item {
1807 border-image: url(branch-more.png) 0;
1808}
1809
1810QTreeView::branch:!has-children:!has-siblings:adjoins-item {
1811 border-image: url(branch-end.png) 0;
1812}
1813
1814QTreeView::branch:has-children:!has-siblings:closed,
1815QTreeView::branch:closed:has-children:has-siblings {
1816 border-image: none;
1817 image: url(branch-closed.png);
1818}
1819
1820QTreeView::branch:open:has-children:!has-siblings,
1821QTreeView::branch:open:has-children:has-siblings {
1822 border-image: none;
1823 image: url(branch-open.png);
1824}
1825//! [158]
1826
1827//! [159]
1828QTabBar::close-button {
1829 image: url(close.png)
1830 subcontrol-position: left;
1831}
1832QTabBar::close-button:hover {
1833 image: url(close-hover.png)
1834}
1835
1836//! [159]
1837
1838//! [160]
1839* { lineedit-password-mask-delay: 1000 }
1840//! [160]
1841
1842//! [161]
1843QTableView::indicator:unchecked {
1844 background-color: #d7d6d5
1845}
1846//! [161]
1847
1848//! [162]
1849* { widget-animation-duration: 100 }
1850//! [162]
1851
1852//! [163]
1853QLineEdit { placeholder-text-color: #800000ff } /* semi-transparent blue */
1854//! [163]