source: trunk/doc/src/snippets/code/doc_src_stylesheet.qdoc

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

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