summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/images/check_list_controller.svg21
-rw-r--r--src/widgets/styles/images/cleartext-128.pngbin0 -> 3638 bytes
-rw-r--r--src/widgets/styles/images/cleartext-16.pngbin760 -> 985 bytes
-rw-r--r--src/widgets/styles/images/cleartext-32.pngbin410 -> 1310 bytes
-rw-r--r--src/widgets/styles/images/cleartext.svg71
-rw-r--r--src/widgets/styles/images/closedock-down-macstyle-10.pngbin0 -> 195 bytes
-rw-r--r--src/widgets/styles/images/closedock-down-macstyle-20.pngbin0 -> 344 bytes
-rw-r--r--src/widgets/styles/images/closedock-down-macstyle-32.pngbin0 -> 474 bytes
-rw-r--r--src/widgets/styles/images/closedock-down-macstyle-48.pngbin0 -> 721 bytes
-rw-r--r--src/widgets/styles/images/closedock-down-macstyle-64.pngbin0 -> 920 bytes
-rw-r--r--src/widgets/styles/images/closedock-down-macstyle.svg15
-rw-r--r--src/widgets/styles/images/closedock-macstyle-10.pngbin0 -> 309 bytes
-rw-r--r--src/widgets/styles/images/closedock-macstyle-20.pngbin0 -> 579 bytes
-rw-r--r--src/widgets/styles/images/closedock-macstyle-32.pngbin0 -> 938 bytes
-rw-r--r--src/widgets/styles/images/closedock-macstyle-48.pngbin0 -> 1236 bytes
-rw-r--r--src/widgets/styles/images/closedock-macstyle-64.pngbin0 -> 1495 bytes
-rw-r--r--src/widgets/styles/images/closedock-macstyle.svg15
-rw-r--r--src/widgets/styles/images/closedock.svg18
-rw-r--r--src/widgets/styles/images/critical-128.pngbin0 -> 2938 bytes
-rw-r--r--src/widgets/styles/images/critical-16.pngbin0 -> 835 bytes
-rw-r--r--src/widgets/styles/images/critical-32.pngbin0 -> 1148 bytes
-rw-r--r--src/widgets/styles/images/critical.svg14
-rw-r--r--src/widgets/styles/images/dockdock-down-macstyle-10.pngbin0 -> 246 bytes
-rw-r--r--src/widgets/styles/images/dockdock-down-macstyle-20.pngbin0 -> 363 bytes
-rw-r--r--src/widgets/styles/images/dockdock-down-macstyle-32.pngbin0 -> 416 bytes
-rw-r--r--src/widgets/styles/images/dockdock-down-macstyle-48.pngbin0 -> 622 bytes
-rw-r--r--src/widgets/styles/images/dockdock-down-macstyle-64.pngbin0 -> 771 bytes
-rw-r--r--src/widgets/styles/images/dockdock-down-macstyle.svg16
-rw-r--r--src/widgets/styles/images/dockdock-macstyle-10.pngbin0 -> 339 bytes
-rw-r--r--src/widgets/styles/images/dockdock-macstyle-20.pngbin0 -> 555 bytes
-rw-r--r--src/widgets/styles/images/dockdock-macstyle-32.pngbin0 -> 654 bytes
-rw-r--r--src/widgets/styles/images/dockdock-macstyle-48.pngbin0 -> 915 bytes
-rw-r--r--src/widgets/styles/images/dockdock-macstyle-64.pngbin0 -> 1212 bytes
-rw-r--r--src/widgets/styles/images/dockdock-macstyle.svg17
-rw-r--r--src/widgets/styles/images/file_open.svg19
-rw-r--r--src/widgets/styles/images/filedialog_end-128.pngbin0 -> 1393 bytes
-rw-r--r--src/widgets/styles/images/filedialog_end-16.pngbin0 -> 686 bytes
-rw-r--r--src/widgets/styles/images/filedialog_end-32.pngbin0 -> 787 bytes
-rw-r--r--src/widgets/styles/images/filedialog_end.svg27
-rw-r--r--src/widgets/styles/images/filedialog_start-128.pngbin0 -> 1326 bytes
-rw-r--r--src/widgets/styles/images/filedialog_start-16.pngbin0 -> 677 bytes
-rw-r--r--src/widgets/styles/images/filedialog_start-32.pngbin0 -> 761 bytes
-rw-r--r--src/widgets/styles/images/filedialog_start.svg27
-rw-r--r--src/widgets/styles/images/fusion_closedock-10.pngbin0 -> 238 bytes
-rw-r--r--src/widgets/styles/images/fusion_closedock-16.pngbin0 -> 288 bytes
-rw-r--r--src/widgets/styles/images/fusion_closedock-20.pngbin0 -> 303 bytes
-rw-r--r--src/widgets/styles/images/fusion_closedock-32.pngbin0 -> 333 bytes
-rw-r--r--src/widgets/styles/images/fusion_closedock-48.pngbin0 -> 492 bytes
-rw-r--r--src/widgets/styles/images/fusion_closedock-64.pngbin0 -> 617 bytes
-rw-r--r--src/widgets/styles/images/fusion_closedock.svg87
-rw-r--r--src/widgets/styles/images/fusion_normalizedockup-16.pngbin0 -> 314 bytes
-rw-r--r--src/widgets/styles/images/fusion_normalizedockup-32.pngbin0 -> 413 bytes
-rw-r--r--src/widgets/styles/images/fusion_normalizedockup.svg75
-rw-r--r--src/widgets/styles/images/fusion_normalizedockup_10.pngbin0 -> 234 bytes
-rw-r--r--src/widgets/styles/images/fusion_normalizedockup_20.pngbin0 -> 342 bytes
-rw-r--r--src/widgets/styles/images/fusion_normalizedockup_48.pngbin0 -> 487 bytes
-rw-r--r--src/widgets/styles/images/fusion_normalizedockup_64.pngbin0 -> 579 bytes
-rw-r--r--src/widgets/styles/images/fusion_titlebar-min-10.pngbin0 -> 167 bytes
-rw-r--r--src/widgets/styles/images/fusion_titlebar-min-16.pngbin0 -> 141 bytes
-rw-r--r--src/widgets/styles/images/fusion_titlebar-min-20.pngbin0 -> 176 bytes
-rw-r--r--src/widgets/styles/images/fusion_titlebar-min-32.pngbin0 -> 214 bytes
-rw-r--r--src/widgets/styles/images/fusion_titlebar-min-48.pngbin0 -> 179 bytes
-rw-r--r--src/widgets/styles/images/fusion_titlebar-min-64.pngbin0 -> 190 bytes
-rw-r--r--src/widgets/styles/images/fusion_titlebar-min.svg67
-rw-r--r--src/widgets/styles/images/information-128.pngbin0 -> 2099 bytes
-rw-r--r--src/widgets/styles/images/information-16.pngbin0 -> 697 bytes
-rw-r--r--src/widgets/styles/images/information-32.pngbin0 -> 874 bytes
-rw-r--r--src/widgets/styles/images/information.svg14
-rw-r--r--src/widgets/styles/images/media-pause-128.pngbin0 -> 262 bytes
-rw-r--r--src/widgets/styles/images/media-pause-16.pngbin229 -> 141 bytes
-rw-r--r--src/widgets/styles/images/media-pause-32.pngbin185 -> 157 bytes
-rw-r--r--src/widgets/styles/images/media-pause.svg67
-rw-r--r--src/widgets/styles/images/media-play-128.pngbin0 -> 584 bytes
-rw-r--r--src/widgets/styles/images/media-play-16.pngbin262 -> 172 bytes
-rw-r--r--src/widgets/styles/images/media-play-32.pngbin413 -> 227 bytes
-rw-r--r--src/widgets/styles/images/media-play.svg57
-rw-r--r--src/widgets/styles/images/media-seek-backward-128.pngbin0 -> 532 bytes
-rw-r--r--src/widgets/styles/images/media-seek-backward-16.pngbin384 -> 182 bytes
-rw-r--r--src/widgets/styles/images/media-seek-backward-32.pngbin548 -> 235 bytes
-rw-r--r--src/widgets/styles/images/media-seek-backward.svg62
-rw-r--r--src/widgets/styles/images/media-seek-forward-128.pngbin0 -> 544 bytes
-rw-r--r--src/widgets/styles/images/media-seek-forward-16.pngbin370 -> 175 bytes
-rw-r--r--src/widgets/styles/images/media-seek-forward-32.pngbin524 -> 232 bytes
-rw-r--r--src/widgets/styles/images/media-seek-forward.svg61
-rw-r--r--src/widgets/styles/images/media-skip-backward-128.pngbin0 -> 582 bytes
-rw-r--r--src/widgets/styles/images/media-skip-backward-16.pngbin396 -> 183 bytes
-rw-r--r--src/widgets/styles/images/media-skip-backward-32.pngbin570 -> 248 bytes
-rw-r--r--src/widgets/styles/images/media-skip-backward.svg67
-rw-r--r--src/widgets/styles/images/media-skip-forward-128.pngbin0 -> 532 bytes
-rw-r--r--src/widgets/styles/images/media-skip-forward-16.pngbin384 -> 176 bytes
-rw-r--r--src/widgets/styles/images/media-skip-forward-32.pngbin549 -> 233 bytes
-rw-r--r--src/widgets/styles/images/media-skip-forward.svg67
-rw-r--r--src/widgets/styles/images/media-stop-128.pngbin0 -> 264 bytes
-rw-r--r--src/widgets/styles/images/media-stop-16.pngbin166 -> 136 bytes
-rw-r--r--src/widgets/styles/images/media-stop-32.pngbin176 -> 147 bytes
-rw-r--r--src/widgets/styles/images/media-stop.svg60
-rw-r--r--src/widgets/styles/images/qt_close.svg18
-rw-r--r--src/widgets/styles/images/qt_help.svg25
-rw-r--r--src/widgets/styles/images/qt_maximize.svg12
-rw-r--r--src/widgets/styles/images/qt_menu.svg22
-rw-r--r--src/widgets/styles/images/qt_minimize.svg15
-rw-r--r--src/widgets/styles/images/qt_normalizeup.svg20
-rw-r--r--src/widgets/styles/images/qt_shade.svg15
-rw-r--r--src/widgets/styles/images/qt_unshade.svg15
-rw-r--r--src/widgets/styles/images/question-128.pngbin0 -> 2770 bytes
-rw-r--r--src/widgets/styles/images/question-16.pngbin0 -> 797 bytes
-rw-r--r--src/widgets/styles/images/question-32.pngbin0 -> 1063 bytes
-rw-r--r--src/widgets/styles/images/question.svg21
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-128.pngbin0 -> 1657 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-16.pngbin406 -> 674 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-32.pngbin305 -> 819 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-down-128.pngbin0 -> 1599 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-down-16.pngbin481 -> 666 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-down-32.pngbin278 -> 810 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-down.svg85
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-hover-128.pngbin0 -> 1660 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-hover-16.pngbin570 -> 675 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-hover-32.pngbin305 -> 822 bytes
-rw-r--r--src/widgets/styles/images/standardbutton-closetab-hover.svg86
-rw-r--r--src/widgets/styles/images/standardbutton-closetab.svg86
-rw-r--r--src/widgets/styles/images/toolbar-ext-h-128.pngbin0 -> 1765 bytes
-rw-r--r--src/widgets/styles/images/toolbar-ext-h-rtl-128.pngbin0 -> 1740 bytes
-rw-r--r--src/widgets/styles/images/toolbar-ext-h.svg16
-rw-r--r--src/widgets/styles/images/toolbar-ext-v-80.pngbin0 -> 2035 bytes
-rw-r--r--src/widgets/styles/images/toolbar-ext-v.svg16
-rw-r--r--src/widgets/styles/images/warning-128.pngbin0 -> 1625 bytes
-rw-r--r--src/widgets/styles/images/warning-16.pngbin0 -> 660 bytes
-rw-r--r--src/widgets/styles/images/warning-32.pngbin0 -> 799 bytes
-rw-r--r--src/widgets/styles/images/warning.svg16
-rw-r--r--src/widgets/styles/qcommonstyle.cpp2049
-rw-r--r--src/widgets/styles/qcommonstyle.h43
-rw-r--r--src/widgets/styles/qcommonstyle_p.h63
-rw-r--r--src/widgets/styles/qcommonstylepixmaps_p.h42
-rw-r--r--src/widgets/styles/qdrawutil.cpp189
-rw-r--r--src/widgets/styles/qdrawutil.h55
-rw-r--r--src/widgets/styles/qfusionstyle.cpp785
-rw-r--r--src/widgets/styles/qfusionstyle_p.h41
-rw-r--r--src/widgets/styles/qfusionstyle_p_p.h40
-rw-r--r--src/widgets/styles/qpixmapstyle.cpp52
-rw-r--r--src/widgets/styles/qpixmapstyle_p.h44
-rw-r--r--src/widgets/styles/qpixmapstyle_p_p.h40
-rw-r--r--src/widgets/styles/qproxystyle.cpp58
-rw-r--r--src/widgets/styles/qproxystyle.h40
-rw-r--r--src/widgets/styles/qproxystyle_p.h42
-rw-r--r--src/widgets/styles/qstyle.cpp133
-rw-r--r--src/widgets/styles/qstyle.h56
-rw-r--r--src/widgets/styles/qstyle.qrc179
-rw-r--r--src/widgets/styles/qstyle_p.h68
-rw-r--r--src/widgets/styles/qstyleanimation.cpp41
-rw-r--r--src/widgets/styles/qstyleanimation_p.h40
-rw-r--r--src/widgets/styles/qstylefactory.cpp58
-rw-r--r--src/widgets/styles/qstylefactory.h40
-rw-r--r--src/widgets/styles/qstylehelper.cpp69
-rw-r--r--src/widgets/styles/qstylehelper_p.h44
-rw-r--r--src/widgets/styles/qstyleoption.cpp120
-rw-r--r--src/widgets/styles/qstyleoption.h43
-rw-r--r--src/widgets/styles/qstylepainter.cpp40
-rw-r--r--src/widgets/styles/qstylepainter.h46
-rw-r--r--src/widgets/styles/qstyleplugin.cpp40
-rw-r--r--src/widgets/styles/qstyleplugin.h40
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp1079
-rw-r--r--src/widgets/styles/qstylesheetstyle_default.cpp213
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h42
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp233
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h40
-rw-r--r--src/widgets/styles/qwindowsstyle_p_p.h49
166 files changed, 3871 insertions, 3837 deletions
diff --git a/src/widgets/styles/images/check_list_controller.svg b/src/widgets/styles/images/check_list_controller.svg
new file mode 100644
index 0000000000..ea94cf4d5d
--- /dev/null
+++ b/src/widgets/styles/images/check_list_controller.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="16px" height="16px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#BDBEBF;}
+ .st1{fill:#FACE20;}
+ .st2{fill:none;}
+</style>
+<g>
+ <g>
+ <rect x="3" y="4" class="st0" width="10" height="10"/>
+ </g>
+ <g>
+ <rect x="1" y="2" class="st1" width="10" height="10"/>
+ </g>
+ <g>
+ <rect class="st2" width="16" height="16"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/cleartext-128.png b/src/widgets/styles/images/cleartext-128.png
new file mode 100644
index 0000000000..b5a2ceb233
--- /dev/null
+++ b/src/widgets/styles/images/cleartext-128.png
Binary files differ
diff --git a/src/widgets/styles/images/cleartext-16.png b/src/widgets/styles/images/cleartext-16.png
index 74133bafff..53c42929cb 100644
--- a/src/widgets/styles/images/cleartext-16.png
+++ b/src/widgets/styles/images/cleartext-16.png
Binary files differ
diff --git a/src/widgets/styles/images/cleartext-32.png b/src/widgets/styles/images/cleartext-32.png
index ff5a2b5ec1..e7ecf70d6d 100644
--- a/src/widgets/styles/images/cleartext-32.png
+++ b/src/widgets/styles/images/cleartext-32.png
Binary files differ
diff --git a/src/widgets/styles/images/cleartext.svg b/src/widgets/styles/images/cleartext.svg
new file mode 100644
index 0000000000..d93c0c6b96
--- /dev/null
+++ b/src/widgets/styles/images/cleartext.svg
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="cleartext.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="33.14563"
+ inkscape:cx="1.0250743"
+ inkscape:cy="9.2813006"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1" />
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<circle
+ style="fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.0875;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path873"
+ cx="8"
+ cy="8"
+ r="7"
+ inkscape:label="circle" /><rect
+ id="rect19"
+ width="2.0723703"
+ height="9.2413387"
+ x="10.277523"
+ y="-4.6206694"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.101216;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="rotate(44.999999)"
+ inkscape:label="rect2" /><rect
+ id="rect19-6"
+ width="2.0723705"
+ height="9.2413378"
+ x="-1.0361853"
+ y="6.6930394"
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.101217;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ transform="rotate(-45)"
+ inkscape:label="rect1"
+ sodipodi:insensitive="true" /></svg>
diff --git a/src/widgets/styles/images/closedock-down-macstyle-10.png b/src/widgets/styles/images/closedock-down-macstyle-10.png
new file mode 100644
index 0000000000..45862f93ff
--- /dev/null
+++ b/src/widgets/styles/images/closedock-down-macstyle-10.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-down-macstyle-20.png b/src/widgets/styles/images/closedock-down-macstyle-20.png
new file mode 100644
index 0000000000..9112f6968f
--- /dev/null
+++ b/src/widgets/styles/images/closedock-down-macstyle-20.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-down-macstyle-32.png b/src/widgets/styles/images/closedock-down-macstyle-32.png
new file mode 100644
index 0000000000..ec91d61c1c
--- /dev/null
+++ b/src/widgets/styles/images/closedock-down-macstyle-32.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-down-macstyle-48.png b/src/widgets/styles/images/closedock-down-macstyle-48.png
new file mode 100644
index 0000000000..dee933d8b3
--- /dev/null
+++ b/src/widgets/styles/images/closedock-down-macstyle-48.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-down-macstyle-64.png b/src/widgets/styles/images/closedock-down-macstyle-64.png
new file mode 100644
index 0000000000..134e9c5a1f
--- /dev/null
+++ b/src/widgets/styles/images/closedock-down-macstyle-64.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-down-macstyle.svg b/src/widgets/styles/images/closedock-down-macstyle.svg
new file mode 100644
index 0000000000..04f841937a
--- /dev/null
+++ b/src/widgets/styles/images/closedock-down-macstyle.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:none;}
+</style>
+<g>
+ <path d="M8,1C4.13,1,1,4.13,1,8c0,3.87,3.13,7,7,7s7-3.13,7-7C15,4.13,11.87,1,8,1z M11.18,9.77c0.39,0.39,0.39,1.02,0,1.41
+ c-0.2,0.2-0.45,0.29-0.71,0.29s-0.51-0.1-0.71-0.29L8,9.41l-1.77,1.77c-0.2,0.2-0.45,0.29-0.71,0.29s-0.51-0.1-0.71-0.29
+ c-0.39-0.39-0.39-1.02,0-1.41L6.59,8L4.82,6.23c-0.39-0.39-0.39-1.02,0-1.41s1.02-0.39,1.41,0L8,6.59l1.77-1.77
+ c0.39-0.39,1.02-0.39,1.41,0s0.39,1.02,0,1.41L9.41,8L11.18,9.77z"/>
+ <rect class="st0" width="16" height="16"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/closedock-macstyle-10.png b/src/widgets/styles/images/closedock-macstyle-10.png
new file mode 100644
index 0000000000..3746c7af00
--- /dev/null
+++ b/src/widgets/styles/images/closedock-macstyle-10.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-macstyle-20.png b/src/widgets/styles/images/closedock-macstyle-20.png
new file mode 100644
index 0000000000..78cc630ea1
--- /dev/null
+++ b/src/widgets/styles/images/closedock-macstyle-20.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-macstyle-32.png b/src/widgets/styles/images/closedock-macstyle-32.png
new file mode 100644
index 0000000000..564efe187b
--- /dev/null
+++ b/src/widgets/styles/images/closedock-macstyle-32.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-macstyle-48.png b/src/widgets/styles/images/closedock-macstyle-48.png
new file mode 100644
index 0000000000..7c9f1b8960
--- /dev/null
+++ b/src/widgets/styles/images/closedock-macstyle-48.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-macstyle-64.png b/src/widgets/styles/images/closedock-macstyle-64.png
new file mode 100644
index 0000000000..399548d014
--- /dev/null
+++ b/src/widgets/styles/images/closedock-macstyle-64.png
Binary files differ
diff --git a/src/widgets/styles/images/closedock-macstyle.svg b/src/widgets/styles/images/closedock-macstyle.svg
new file mode 100644
index 0000000000..9348997f7b
--- /dev/null
+++ b/src/widgets/styles/images/closedock-macstyle.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#5E5E5E;}
+ .st1{fill:none;}
+</style>
+<g>
+ <path class="st0" d="M8,1C4.1,1,1,4.1,1,8c0,3.9,3.1,7,7,7s7-3.1,7-7C15,4.1,11.9,1,8,1z M11.2,9.8c0.4,0.4,0.4,1,0,1.4
+ c-0.2,0.2-0.5,0.3-0.7,0.3s-0.5-0.1-0.7-0.3L8,9.4l-1.8,1.8c-0.2,0.2-0.5,0.3-0.7,0.3S5,11.4,4.8,11.2c-0.4-0.4-0.4-1,0-1.4L6.6,8
+ L4.8,6.2c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0L8,6.6l1.8-1.8c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4L9.4,8L11.2,9.8z"/>
+ <rect class="st1" width="16" height="16"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/closedock.svg b/src/widgets/styles/images/closedock.svg
new file mode 100644
index 0000000000..dfd6be6d48
--- /dev/null
+++ b/src/widgets/styles/images/closedock.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="8px" height="8px" viewBox="0 0 8 8" style="enable-background:new 0 0 8 8;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:none;}
+ .st1{fill:#353637;}
+</style>
+<g>
+ <g>
+ <rect class="st0" width="8" height="8"/>
+ </g>
+ <g>
+ <rect x="3.3" y="0.1" transform="matrix(0.7071 0.7071 -0.7071 0.7071 4 -1.6569)" class="st1" width="1.4" height="7.8"/>
+ <rect x="3.3" y="0.1" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 9.6569 4)" class="st1" width="1.4" height="7.8"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/critical-128.png b/src/widgets/styles/images/critical-128.png
new file mode 100644
index 0000000000..329963cb38
--- /dev/null
+++ b/src/widgets/styles/images/critical-128.png
Binary files differ
diff --git a/src/widgets/styles/images/critical-16.png b/src/widgets/styles/images/critical-16.png
new file mode 100644
index 0000000000..d9da98beee
--- /dev/null
+++ b/src/widgets/styles/images/critical-16.png
Binary files differ
diff --git a/src/widgets/styles/images/critical-32.png b/src/widgets/styles/images/critical-32.png
new file mode 100644
index 0000000000..04d52591c3
--- /dev/null
+++ b/src/widgets/styles/images/critical-32.png
Binary files differ
diff --git a/src/widgets/styles/images/critical.svg b/src/widgets/styles/images/critical.svg
new file mode 100644
index 0000000000..8be2931e68
--- /dev/null
+++ b/src/widgets/styles/images/critical.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="32px" height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#E41E25;}
+ .st1{fill:none;}
+</style>
+<g id="editclear">
+ <path class="st0" d="M16,2.1c-7.7,0-14,6.3-14,14s6.3,14,14,14c7.7,0,14-6.3,14-14S23.8,2.1,16,2.1z M23.5,21.3l-2.3,2.3L16,18.3
+ l-5.2,5.2l-2.3-2.3l5.2-5.2l-5.2-5.2l2.3-2.3l5.2,5.2l5.2-5.2l2.3,2.3L18.3,16L23.5,21.3z"/>
+ <rect class="st1" width="32" height="32"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/dockdock-down-macstyle-10.png b/src/widgets/styles/images/dockdock-down-macstyle-10.png
new file mode 100644
index 0000000000..44215cadec
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-down-macstyle-10.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-down-macstyle-20.png b/src/widgets/styles/images/dockdock-down-macstyle-20.png
new file mode 100644
index 0000000000..265da15789
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-down-macstyle-20.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-down-macstyle-32.png b/src/widgets/styles/images/dockdock-down-macstyle-32.png
new file mode 100644
index 0000000000..394e90dcd3
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-down-macstyle-32.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-down-macstyle-48.png b/src/widgets/styles/images/dockdock-down-macstyle-48.png
new file mode 100644
index 0000000000..34c1640597
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-down-macstyle-48.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-down-macstyle-64.png b/src/widgets/styles/images/dockdock-down-macstyle-64.png
new file mode 100644
index 0000000000..12435d8c73
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-down-macstyle-64.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-down-macstyle.svg b/src/widgets/styles/images/dockdock-down-macstyle.svg
new file mode 100644
index 0000000000..d970fe7edf
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-down-macstyle.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:none;}
+</style>
+<g>
+ <rect class="st0" width="16" height="16"/>
+ <g>
+ <rect x="5" y="8" width="4" height="3"/>
+ <polygon points="10,9 11,9 11,6 7,6 7,7 10,7 "/>
+ <path d="M8,1C4.13,1,1,4.13,1,8c0,3.87,3.13,7,7,7s7-3.13,7-7C15,4.13,11.87,1,8,1z M12,10h-2v2H4V7h2V5h6V10z"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/dockdock-macstyle-10.png b/src/widgets/styles/images/dockdock-macstyle-10.png
new file mode 100644
index 0000000000..e4d9d147ca
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-macstyle-10.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-macstyle-20.png b/src/widgets/styles/images/dockdock-macstyle-20.png
new file mode 100644
index 0000000000..3e9233dc82
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-macstyle-20.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-macstyle-32.png b/src/widgets/styles/images/dockdock-macstyle-32.png
new file mode 100644
index 0000000000..5639a73e94
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-macstyle-32.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-macstyle-48.png b/src/widgets/styles/images/dockdock-macstyle-48.png
new file mode 100644
index 0000000000..fd8c91b094
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-macstyle-48.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-macstyle-64.png b/src/widgets/styles/images/dockdock-macstyle-64.png
new file mode 100644
index 0000000000..43dc7ed091
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-macstyle-64.png
Binary files differ
diff --git a/src/widgets/styles/images/dockdock-macstyle.svg b/src/widgets/styles/images/dockdock-macstyle.svg
new file mode 100644
index 0000000000..f29fb8bc9f
--- /dev/null
+++ b/src/widgets/styles/images/dockdock-macstyle.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:none;}
+ .st1{fill:#5E5E5E;}
+</style>
+<g>
+ <rect class="st0" width="16" height="16"/>
+ <g>
+ <rect x="5" y="8" class="st1" width="4" height="3"/>
+ <polygon class="st1" points="10,9 11,9 11,6 7,6 7,7 10,7 "/>
+ <path class="st1" d="M8,1C4.1,1,1,4.1,1,8c0,3.9,3.1,7,7,7s7-3.1,7-7C15,4.1,11.9,1,8,1z M12,10h-2v2H4V7h2V5h6V10z"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/file_open.svg b/src/widgets/styles/images/file_open.svg
new file mode 100644
index 0000000000..d80bd5b32e
--- /dev/null
+++ b/src/widgets/styles/images/file_open.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="22px" height="22px" viewBox="0 0 22 22" style="enable-background:new 0 0 22 22;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#FACE20;}
+ .st1{fill:none;}
+ .st2{fill:#353637;}
+</style>
+<g>
+ <polygon class="st0" points="8,13 2.7,18 2,18 2,17 7,12 17,12 17,9 8,9 6,7 0,7 0,16 0,20 1,20 2,20 4,20 15,20 21,13 "/>
+ <rect class="st1" width="22" height="22"/>
+ <g>
+ <path class="st2" d="M19.4,9.9l-0.7-0.7C18.9,8.6,19,8.1,19,7.5c0-2.2-1.8-4-4-4c-0.9,0-1.7,0.3-2.4,0.8l-0.7-0.7
+ c0.9-0.7,1.9-1.1,3.1-1.1c2.8,0,5,2.2,5,5C20,8.4,19.8,9.2,19.4,9.9z"/>
+ <polygon class="st2" points="17,7.5 22,7.5 19.5,10 "/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/filedialog_end-128.png b/src/widgets/styles/images/filedialog_end-128.png
new file mode 100644
index 0000000000..f634792d2a
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_end-128.png
Binary files differ
diff --git a/src/widgets/styles/images/filedialog_end-16.png b/src/widgets/styles/images/filedialog_end-16.png
new file mode 100644
index 0000000000..51fe8d1559
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_end-16.png
Binary files differ
diff --git a/src/widgets/styles/images/filedialog_end-32.png b/src/widgets/styles/images/filedialog_end-32.png
new file mode 100644
index 0000000000..faa3a10293
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_end-32.png
Binary files differ
diff --git a/src/widgets/styles/images/filedialog_end.svg b/src/widgets/styles/images/filedialog_end.svg
new file mode 100644
index 0000000000..b52b4b66a3
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_end.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="16px" height="16px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#FACE20;}
+ .st1{fill:#FFFFFF;}
+ .st2{fill:#353637;}
+ .st3{fill:none;}
+</style>
+<g>
+ <polygon class="st0" points="13,8 15,16 16,16 16,5 7,5 6,4 2,4 2,8 "/>
+ <g>
+ <g>
+ <polygon class="st1" points="2.5,13.5 2.5,3.5 6.8,3.5 9.5,6.2 9.5,13.5 "/>
+ <path class="st2" d="M6.6,4L9,6.4V13H3V4H6.6 M7,3H2v11h8V6L7,3L7,3z"/>
+ </g>
+ <g>
+ <polygon class="st2" points="9,7 6,7 6,4 7,4 7,6 9,6 "/>
+ </g>
+ </g>
+ <polygon class="st0" points="12,9 13.3,14 16,14 16,16 10,16 2,16 0,9 "/>
+ <g>
+ <rect class="st3" width="16" height="16"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/filedialog_start-128.png b/src/widgets/styles/images/filedialog_start-128.png
new file mode 100644
index 0000000000..f1272bd169
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_start-128.png
Binary files differ
diff --git a/src/widgets/styles/images/filedialog_start-16.png b/src/widgets/styles/images/filedialog_start-16.png
new file mode 100644
index 0000000000..04430f53c9
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_start-16.png
Binary files differ
diff --git a/src/widgets/styles/images/filedialog_start-32.png b/src/widgets/styles/images/filedialog_start-32.png
new file mode 100644
index 0000000000..c8b81a5ec7
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_start-32.png
Binary files differ
diff --git a/src/widgets/styles/images/filedialog_start.svg b/src/widgets/styles/images/filedialog_start.svg
new file mode 100644
index 0000000000..2dad8e1922
--- /dev/null
+++ b/src/widgets/styles/images/filedialog_start.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="16px" height="16px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#FACE20;}
+ .st1{fill:#FFFFFF;}
+ .st2{fill:#353637;}
+ .st3{fill:none;}
+</style>
+<g>
+ <polygon class="st0" points="13,8 15,16 16,16 16,5 7,5 6,4 2,4 2,8 "/>
+ <g>
+ <g>
+ <polygon class="st1" points="6.5,13.5 6.5,2.5 11.8,2.5 15.5,6.2 15.5,13.5 "/>
+ <path class="st2" d="M11.6,3L15,6.4V13H7V3H11.6 M12,2H6v12h10V6L12,2L12,2z"/>
+ </g>
+ <g>
+ <polygon class="st2" points="15,7 11,7 11,3 12,3 12,6 15,6 "/>
+ </g>
+ </g>
+ <polygon class="st0" points="12,9 13.3,14 16,14 16,16 9,16 2,16 0,9 "/>
+ <g>
+ <rect class="st3" width="16" height="16"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/fusion_closedock-10.png b/src/widgets/styles/images/fusion_closedock-10.png
new file mode 100644
index 0000000000..d0c34d618b
--- /dev/null
+++ b/src/widgets/styles/images/fusion_closedock-10.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_closedock-16.png b/src/widgets/styles/images/fusion_closedock-16.png
new file mode 100644
index 0000000000..889c91e43f
--- /dev/null
+++ b/src/widgets/styles/images/fusion_closedock-16.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_closedock-20.png b/src/widgets/styles/images/fusion_closedock-20.png
new file mode 100644
index 0000000000..9076683d11
--- /dev/null
+++ b/src/widgets/styles/images/fusion_closedock-20.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_closedock-32.png b/src/widgets/styles/images/fusion_closedock-32.png
new file mode 100644
index 0000000000..a2a3328a50
--- /dev/null
+++ b/src/widgets/styles/images/fusion_closedock-32.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_closedock-48.png b/src/widgets/styles/images/fusion_closedock-48.png
new file mode 100644
index 0000000000..e915a1098b
--- /dev/null
+++ b/src/widgets/styles/images/fusion_closedock-48.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_closedock-64.png b/src/widgets/styles/images/fusion_closedock-64.png
new file mode 100644
index 0000000000..73c60feb6a
--- /dev/null
+++ b/src/widgets/styles/images/fusion_closedock-64.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_closedock.svg b/src/widgets/styles/images/fusion_closedock.svg
new file mode 100644
index 0000000000..eb5e472ce2
--- /dev/null
+++ b/src/widgets/styles/images/fusion_closedock.svg
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="8px"
+ height="8px"
+ viewBox="0 0 8 8"
+ style="enable-background:new 0 0 8 8;"
+ xml:space="preserve"
+ sodipodi:docname="fusion_closedock.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/fusion_closedock-64.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata120"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs118">
+
+
+
+
+
+ </defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="917"
+ id="namedview116"
+ showgrid="false"
+ inkscape:zoom="63.727999"
+ inkscape:cx="5.1718865"
+ inkscape:cy="4.7238684"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0" />
+<style
+ type="text/css"
+ id="style101">
+ .st0{fill:none;}
+ .st1{fill:#353637;}
+</style>
+<g
+ id="g105">
+
+ </g>
+<g
+ id="g981"><rect
+ x="5.1188383"
+ y="-2.9975181"
+ transform="rotate(45.000001)"
+ class="st1"
+ width="1.0760319"
+ height="5.9950356"
+ id="rect107"
+ style="fill:#6c6a67;fill-opacity:1;stroke-width:0.768594" /><rect
+ x="-0.53801638"
+ y="-8.6545134"
+ transform="rotate(135)"
+ class="st1"
+ width="1.0760319"
+ height="5.9950356"
+ id="rect109"
+ style="fill:#6c6a67;fill-opacity:1;stroke-width:0.768594" /><rect
+ style="fill:none;stroke:#6c6a67;stroke-width:0.469731;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect151"
+ width="6.5302691"
+ height="6.5302691"
+ x="0.73486549"
+ y="0.73486549" /></g></svg>
diff --git a/src/widgets/styles/images/fusion_normalizedockup-16.png b/src/widgets/styles/images/fusion_normalizedockup-16.png
new file mode 100644
index 0000000000..9e8d1f4716
--- /dev/null
+++ b/src/widgets/styles/images/fusion_normalizedockup-16.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_normalizedockup-32.png b/src/widgets/styles/images/fusion_normalizedockup-32.png
new file mode 100644
index 0000000000..453449cc7d
--- /dev/null
+++ b/src/widgets/styles/images/fusion_normalizedockup-32.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_normalizedockup.svg b/src/widgets/styles/images/fusion_normalizedockup.svg
new file mode 100644
index 0000000000..0d7068b563
--- /dev/null
+++ b/src/widgets/styles/images/fusion_normalizedockup.svg
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="8px"
+ height="8px"
+ viewBox="0 0 8 8"
+ style="enable-background:new 0 0 8 8;"
+ xml:space="preserve"
+ sodipodi:docname="fusion_normalizedockup.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/fusion_normalizedockup_64.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata120"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs118">
+
+
+
+
+
+ </defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="917"
+ id="namedview116"
+ showgrid="false"
+ inkscape:zoom="63.727999"
+ inkscape:cx="3.979318"
+ inkscape:cy="4.7238684"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g1123"
+ inkscape:document-rotation="0" />
+<style
+ type="text/css"
+ id="style101">
+ .st0{fill:none;}
+ .st1{fill:#353637;}
+</style>
+
+<rect
+ style="fill:none;stroke:#6c6a67;stroke-width:0.469731;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect151"
+ width="6.5302691"
+ height="6.5302691"
+ x="0.73486549"
+ y="0.73486549" /><g
+ id="g1123"
+ transform="matrix(0.85891433,0,0,0.86643038,0.5610817,0.55019701)"><path
+ id="rect151-3-6"
+ style="fill:none;stroke:#6c6a67;stroke-width:0.5;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 2.6347656,1.6347656 v 1 h 2.7304688 v 2.7304688 h 1 V 1.6347656 Z" /><path
+ style="fill:none;fill-opacity:1;stroke:#6c6a67;stroke-width:0.5;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 1.634209,2.6342089 H 5.3657907 V 6.3657906 H 1.634209 Z"
+ id="rect151-3" /></g></svg>
diff --git a/src/widgets/styles/images/fusion_normalizedockup_10.png b/src/widgets/styles/images/fusion_normalizedockup_10.png
new file mode 100644
index 0000000000..7516e4ee4f
--- /dev/null
+++ b/src/widgets/styles/images/fusion_normalizedockup_10.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_normalizedockup_20.png b/src/widgets/styles/images/fusion_normalizedockup_20.png
new file mode 100644
index 0000000000..2bc9421d5a
--- /dev/null
+++ b/src/widgets/styles/images/fusion_normalizedockup_20.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_normalizedockup_48.png b/src/widgets/styles/images/fusion_normalizedockup_48.png
new file mode 100644
index 0000000000..6c497abdde
--- /dev/null
+++ b/src/widgets/styles/images/fusion_normalizedockup_48.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_normalizedockup_64.png b/src/widgets/styles/images/fusion_normalizedockup_64.png
new file mode 100644
index 0000000000..5ec620e5a0
--- /dev/null
+++ b/src/widgets/styles/images/fusion_normalizedockup_64.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_titlebar-min-10.png b/src/widgets/styles/images/fusion_titlebar-min-10.png
new file mode 100644
index 0000000000..97b1ab88c3
--- /dev/null
+++ b/src/widgets/styles/images/fusion_titlebar-min-10.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_titlebar-min-16.png b/src/widgets/styles/images/fusion_titlebar-min-16.png
new file mode 100644
index 0000000000..b318a232b3
--- /dev/null
+++ b/src/widgets/styles/images/fusion_titlebar-min-16.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_titlebar-min-20.png b/src/widgets/styles/images/fusion_titlebar-min-20.png
new file mode 100644
index 0000000000..4a6012bd2b
--- /dev/null
+++ b/src/widgets/styles/images/fusion_titlebar-min-20.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_titlebar-min-32.png b/src/widgets/styles/images/fusion_titlebar-min-32.png
new file mode 100644
index 0000000000..6e1c94827e
--- /dev/null
+++ b/src/widgets/styles/images/fusion_titlebar-min-32.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_titlebar-min-48.png b/src/widgets/styles/images/fusion_titlebar-min-48.png
new file mode 100644
index 0000000000..a79724f3ea
--- /dev/null
+++ b/src/widgets/styles/images/fusion_titlebar-min-48.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_titlebar-min-64.png b/src/widgets/styles/images/fusion_titlebar-min-64.png
new file mode 100644
index 0000000000..5dba9a0979
--- /dev/null
+++ b/src/widgets/styles/images/fusion_titlebar-min-64.png
Binary files differ
diff --git a/src/widgets/styles/images/fusion_titlebar-min.svg b/src/widgets/styles/images/fusion_titlebar-min.svg
new file mode 100644
index 0000000000..9f6350c8bf
--- /dev/null
+++ b/src/widgets/styles/images/fusion_titlebar-min.svg
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="8px"
+ height="8px"
+ viewBox="0 0 8 8"
+ style="enable-background:new 0 0 8 8;"
+ xml:space="preserve"
+ sodipodi:docname="fusion_titlebar-min.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/fusion_titlebar-min-64.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata120"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs118">
+
+
+
+
+
+ </defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="917"
+ id="namedview116"
+ showgrid="false"
+ inkscape:zoom="45.0625"
+ inkscape:cx="-0.80217757"
+ inkscape:cy="6.6858335"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0" />
+<style
+ type="text/css"
+ id="style101">
+ .st0{fill:none;}
+ .st1{fill:#353637;}
+</style>
+
+<rect
+ style="fill:#6c6a67;fill-opacity:1;stroke:none;stroke-width:0.529435;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1157"
+ width="5.5"
+ height="1.5"
+ x="1"
+ y="5.5" /></svg>
diff --git a/src/widgets/styles/images/information-128.png b/src/widgets/styles/images/information-128.png
new file mode 100644
index 0000000000..2feebc4598
--- /dev/null
+++ b/src/widgets/styles/images/information-128.png
Binary files differ
diff --git a/src/widgets/styles/images/information-16.png b/src/widgets/styles/images/information-16.png
new file mode 100644
index 0000000000..deb24c71ab
--- /dev/null
+++ b/src/widgets/styles/images/information-16.png
Binary files differ
diff --git a/src/widgets/styles/images/information-32.png b/src/widgets/styles/images/information-32.png
new file mode 100644
index 0000000000..83b32b737a
--- /dev/null
+++ b/src/widgets/styles/images/information-32.png
Binary files differ
diff --git a/src/widgets/styles/images/information.svg b/src/widgets/styles/images/information.svg
new file mode 100644
index 0000000000..da73144eec
--- /dev/null
+++ b/src/widgets/styles/images/information.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="32px" height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#46A2DA;}
+ .st1{fill:none;}
+</style>
+<g>
+ <path class="st0" d="M16,4C9.4,4,4,9.4,4,16c0,6.6,5.4,12,12,12s12-5.4,12-12C28,9.4,22.6,4,16,4z M18,24h-4V14h4V24z M18,12h-4V8
+ h4V12z"/>
+ <rect class="st1" width="32" height="32"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/media-pause-128.png b/src/widgets/styles/images/media-pause-128.png
new file mode 100644
index 0000000000..897ad3c80f
--- /dev/null
+++ b/src/widgets/styles/images/media-pause-128.png
Binary files differ
diff --git a/src/widgets/styles/images/media-pause-16.png b/src/widgets/styles/images/media-pause-16.png
index 6cb1fd7f63..862fd49746 100644
--- a/src/widgets/styles/images/media-pause-16.png
+++ b/src/widgets/styles/images/media-pause-16.png
Binary files differ
diff --git a/src/widgets/styles/images/media-pause-32.png b/src/widgets/styles/images/media-pause-32.png
index 3f172a04d6..ce9b706674 100644
--- a/src/widgets/styles/images/media-pause-32.png
+++ b/src/widgets/styles/images/media-pause-32.png
Binary files differ
diff --git a/src/widgets/styles/images/media-pause.svg b/src/widgets/styles/images/media-pause.svg
new file mode 100644
index 0000000000..c13a4ef400
--- /dev/null
+++ b/src/widgets/styles/images/media-pause.svg
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="media-pause.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/media-pause-128.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="true"
+ inkscape:zoom="16.572815"
+ inkscape:cx="13.411945"
+ inkscape:cy="7.5009653"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0"><inkscape:grid
+ type="xygrid"
+ id="grid925" /></sodipodi:namedview>
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<g
+ id="g1774"><rect
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.0575"
+ id="rect1755"
+ width="3"
+ height="10"
+ x="3.5"
+ y="3" /><rect
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.0575"
+ id="rect1755-3"
+ width="3"
+ height="10"
+ x="9.5"
+ y="3" /></g></svg>
diff --git a/src/widgets/styles/images/media-play-128.png b/src/widgets/styles/images/media-play-128.png
new file mode 100644
index 0000000000..22b260891f
--- /dev/null
+++ b/src/widgets/styles/images/media-play-128.png
Binary files differ
diff --git a/src/widgets/styles/images/media-play-16.png b/src/widgets/styles/images/media-play-16.png
index d7ee3ccbe3..60e86d7fe8 100644
--- a/src/widgets/styles/images/media-play-16.png
+++ b/src/widgets/styles/images/media-play-16.png
Binary files differ
diff --git a/src/widgets/styles/images/media-play-32.png b/src/widgets/styles/images/media-play-32.png
index af8d2f7ba5..d51e130fec 100644
--- a/src/widgets/styles/images/media-play-32.png
+++ b/src/widgets/styles/images/media-play-32.png
Binary files differ
diff --git a/src/widgets/styles/images/media-play.svg b/src/widgets/styles/images/media-play.svg
new file mode 100644
index 0000000000..b0130735f1
--- /dev/null
+++ b/src/widgets/styles/images/media-play.svg
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="media-play.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/media-play-128.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="true"
+ inkscape:zoom="33.14563"
+ inkscape:cx="11.425943"
+ inkscape:cy="9.1913339"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0"><inkscape:grid
+ type="xygrid"
+ id="grid925" /></sodipodi:namedview>
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<path
+ id="rect873"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.93347"
+ d="M 3 3 L 3 13 L 12.896484 8 L 3 3 z " /></svg>
diff --git a/src/widgets/styles/images/media-seek-backward-128.png b/src/widgets/styles/images/media-seek-backward-128.png
new file mode 100644
index 0000000000..3d4470bd5c
--- /dev/null
+++ b/src/widgets/styles/images/media-seek-backward-128.png
Binary files differ
diff --git a/src/widgets/styles/images/media-seek-backward-16.png b/src/widgets/styles/images/media-seek-backward-16.png
index b8a8ea42d1..8bfba869e0 100644
--- a/src/widgets/styles/images/media-seek-backward-16.png
+++ b/src/widgets/styles/images/media-seek-backward-16.png
Binary files differ
diff --git a/src/widgets/styles/images/media-seek-backward-32.png b/src/widgets/styles/images/media-seek-backward-32.png
index a21d1372fe..9148f8a0c6 100644
--- a/src/widgets/styles/images/media-seek-backward-32.png
+++ b/src/widgets/styles/images/media-seek-backward-32.png
Binary files differ
diff --git a/src/widgets/styles/images/media-seek-backward.svg b/src/widgets/styles/images/media-seek-backward.svg
new file mode 100644
index 0000000000..13e1e67e6b
--- /dev/null
+++ b/src/widgets/styles/images/media-seek-backward.svg
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="media-seek-backward.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/media-seek-backward-128.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="true"
+ inkscape:zoom="33.14563"
+ inkscape:cx="12.532344"
+ inkscape:cy="7.584329"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0"><inkscape:grid
+ type="xygrid"
+ id="grid925" /></sodipodi:namedview>
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<g
+ id="g1560"
+ transform="rotate(180,8,7.9999997)"><path
+ id="rect873"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="m 2,4 v 8 L 9,7.9999998 Z" /><path
+ id="rect873-5"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="m 7,4 v 8 l 7,-4.0000002 z" /></g></svg>
diff --git a/src/widgets/styles/images/media-seek-forward-128.png b/src/widgets/styles/images/media-seek-forward-128.png
new file mode 100644
index 0000000000..786136b014
--- /dev/null
+++ b/src/widgets/styles/images/media-seek-forward-128.png
Binary files differ
diff --git a/src/widgets/styles/images/media-seek-forward-16.png b/src/widgets/styles/images/media-seek-forward-16.png
index 3c900dcb62..1ddd379adc 100644
--- a/src/widgets/styles/images/media-seek-forward-16.png
+++ b/src/widgets/styles/images/media-seek-forward-16.png
Binary files differ
diff --git a/src/widgets/styles/images/media-seek-forward-32.png b/src/widgets/styles/images/media-seek-forward-32.png
index 4f8d370fa1..aa0e4b36bd 100644
--- a/src/widgets/styles/images/media-seek-forward-32.png
+++ b/src/widgets/styles/images/media-seek-forward-32.png
Binary files differ
diff --git a/src/widgets/styles/images/media-seek-forward.svg b/src/widgets/styles/images/media-seek-forward.svg
new file mode 100644
index 0000000000..f3753b49a6
--- /dev/null
+++ b/src/widgets/styles/images/media-seek-forward.svg
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="media-seek-forward.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/media-seek-forward-128.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="true"
+ inkscape:zoom="33.14563"
+ inkscape:cx="12.532344"
+ inkscape:cy="7.584329"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0"><inkscape:grid
+ type="xygrid"
+ id="grid925" /></sodipodi:namedview>
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<g
+ id="g1560"><path
+ id="rect873"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="m 2,4 v 8 L 9,7.9999998 Z" /><path
+ id="rect873-5"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="m 7,4 v 8 l 7,-4.0000002 z" /></g></svg>
diff --git a/src/widgets/styles/images/media-skip-backward-128.png b/src/widgets/styles/images/media-skip-backward-128.png
new file mode 100644
index 0000000000..f286da7769
--- /dev/null
+++ b/src/widgets/styles/images/media-skip-backward-128.png
Binary files differ
diff --git a/src/widgets/styles/images/media-skip-backward-16.png b/src/widgets/styles/images/media-skip-backward-16.png
index f5b3f4f56d..644dc4cc01 100644
--- a/src/widgets/styles/images/media-skip-backward-16.png
+++ b/src/widgets/styles/images/media-skip-backward-16.png
Binary files differ
diff --git a/src/widgets/styles/images/media-skip-backward-32.png b/src/widgets/styles/images/media-skip-backward-32.png
index 1d338035ef..ca405e3c01 100644
--- a/src/widgets/styles/images/media-skip-backward-32.png
+++ b/src/widgets/styles/images/media-skip-backward-32.png
Binary files differ
diff --git a/src/widgets/styles/images/media-skip-backward.svg b/src/widgets/styles/images/media-skip-backward.svg
new file mode 100644
index 0000000000..083a0a477e
--- /dev/null
+++ b/src/widgets/styles/images/media-skip-backward.svg
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="media-skip-backward.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/media-skip-backward-128.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="true"
+ inkscape:zoom="33.14563"
+ inkscape:cx="5.5133468"
+ inkscape:cy="10.107665"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0"><inkscape:grid
+ type="xygrid"
+ id="grid925" /></sodipodi:namedview>
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<g
+ id="g1687"><path
+ id="rect873"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="M 14,11.999999 V 3.9999994 L 7,7.9999996 Z" /><path
+ id="rect873-5"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="M 9,11.999999 V 3.9999994 L 2,7.9999996 Z" /><rect
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.13809"
+ id="rect1594"
+ width="1"
+ height="8"
+ x="2"
+ y="4" /></g></svg>
diff --git a/src/widgets/styles/images/media-skip-forward-128.png b/src/widgets/styles/images/media-skip-forward-128.png
new file mode 100644
index 0000000000..d28fbc1708
--- /dev/null
+++ b/src/widgets/styles/images/media-skip-forward-128.png
Binary files differ
diff --git a/src/widgets/styles/images/media-skip-forward-16.png b/src/widgets/styles/images/media-skip-forward-16.png
index 27e205b02f..7e921f9a06 100644
--- a/src/widgets/styles/images/media-skip-forward-16.png
+++ b/src/widgets/styles/images/media-skip-forward-16.png
Binary files differ
diff --git a/src/widgets/styles/images/media-skip-forward-32.png b/src/widgets/styles/images/media-skip-forward-32.png
index a583fa1b11..19b22a5420 100644
--- a/src/widgets/styles/images/media-skip-forward-32.png
+++ b/src/widgets/styles/images/media-skip-forward-32.png
Binary files differ
diff --git a/src/widgets/styles/images/media-skip-forward.svg b/src/widgets/styles/images/media-skip-forward.svg
new file mode 100644
index 0000000000..f2f3c56a8e
--- /dev/null
+++ b/src/widgets/styles/images/media-skip-forward.svg
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="media-skip-forward.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/media-skip-forward-128.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="true"
+ inkscape:zoom="33.14563"
+ inkscape:cx="12.532344"
+ inkscape:cy="7.584329"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0"><inkscape:grid
+ type="xygrid"
+ id="grid925" /></sodipodi:namedview>
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<g
+ id="g1659"><path
+ id="rect873"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="m 2,4 v 8 L 9,7.9999998 Z" /><path
+ id="rect873-5"
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.45442"
+ d="m 7,4 v 8 l 7,-4.0000002 z" /><rect
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2"
+ id="rect1633"
+ width="1"
+ height="8"
+ x="13"
+ y="4" /></g></svg>
diff --git a/src/widgets/styles/images/media-stop-128.png b/src/widgets/styles/images/media-stop-128.png
new file mode 100644
index 0000000000..680d40697c
--- /dev/null
+++ b/src/widgets/styles/images/media-stop-128.png
Binary files differ
diff --git a/src/widgets/styles/images/media-stop-16.png b/src/widgets/styles/images/media-stop-16.png
index 9ce035d696..e047c2bf6b 100644
--- a/src/widgets/styles/images/media-stop-16.png
+++ b/src/widgets/styles/images/media-stop-16.png
Binary files differ
diff --git a/src/widgets/styles/images/media-stop-32.png b/src/widgets/styles/images/media-stop-32.png
index aae24ba925..6ba9d25d4b 100644
--- a/src/widgets/styles/images/media-stop-32.png
+++ b/src/widgets/styles/images/media-stop-32.png
Binary files differ
diff --git a/src/widgets/styles/images/media-stop.svg b/src/widgets/styles/images/media-stop.svg
new file mode 100644
index 0000000000..755755ab9a
--- /dev/null
+++ b/src/widgets/styles/images/media-stop.svg
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ viewBox="0 0 16 16"
+ style="enable-background:new 0 0 16 16;"
+ xml:space="preserve"
+ sodipodi:docname="media-stop.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
+ inkscape:export-filename="/home/chehrlic/kde/qt.src/qtbase/src/widgets/styles/images/media-stop-128.png"
+ inkscape:export-xdpi="768"
+ inkscape:export-ydpi="768"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="true"
+ inkscape:zoom="33.14563"
+ inkscape:cx="5.5133468"
+ inkscape:cy="10.107665"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="Layer_1"
+ inkscape:document-rotation="0"><inkscape:grid
+ type="xygrid"
+ id="grid925" /></sodipodi:namedview>
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+</style>
+
+<rect
+ style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.06992"
+ id="rect1703"
+ width="12"
+ height="12"
+ x="2"
+ y="2" /></svg>
diff --git a/src/widgets/styles/images/qt_close.svg b/src/widgets/styles/images/qt_close.svg
new file mode 100644
index 0000000000..7e95cba298
--- /dev/null
+++ b/src/widgets/styles/images/qt_close.svg
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="10px" viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:none;}
+ .st1{fill:#353637;}
+</style>
+<g>
+ <g>
+ <rect class="st0" width="10" height="10"/>
+ </g>
+ <g>
+ <rect x="4.1" y="0.2" transform="matrix(0.7071 0.7071 -0.7071 0.7071 5.0216 -2.0621)" class="st1" width="1.7" height="9.7"/>
+ <rect x="4.1" y="0.2" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 12.0926 5.0521)" class="st1" width="1.7" height="9.7"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/qt_help.svg b/src/widgets/styles/images/qt_help.svg
new file mode 100644
index 0000000000..8ffa5746ea
--- /dev/null
+++ b/src/widgets/styles/images/qt_help.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="10px" viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#353637;}
+ .st1{fill:none;}
+</style>
+<g>
+ <g>
+ <path class="st0" d="M5.8,9.7C5.6,9.9,5.4,10,5.1,10C5,10,4.8,10,4.7,9.9C4.6,9.9,4.5,9.8,4.4,9.7C4.3,9.6,4.2,9.5,4.1,9.4
+ C4.1,9.3,4,9.1,4,9c0-0.3,0.1-0.5,0.3-0.7C4.6,8.1,4.8,8,5.1,8c0.3,0,0.5,0.1,0.7,0.3C6,8.5,6.1,8.7,6.1,9C6.1,9.3,6,9.5,5.8,9.7z
+ "/>
+ <path class="st0" d="M7.8,3.4C7.7,3.6,7.6,3.8,7.5,4C7.3,4.2,7.2,4.3,7,4.5C6.8,4.7,6.6,4.8,6.4,5C6.3,5.1,6.2,5.2,6.1,5.3
+ C6,5.4,6,5.5,5.9,5.6C5.8,5.7,5.8,5.8,5.8,5.9c0,0.1,0,0.3,0,0.4v0.5H4.1V6.1c0-0.2,0-0.4,0-0.5c0-0.1,0.1-0.3,0.1-0.4
+ C4.4,5.1,4.4,5,4.5,4.9c0.1-0.1,0.2-0.2,0.3-0.4l1-1C6.1,3.3,6.2,3,6.2,2.7c0-0.3-0.1-0.6-0.3-0.8C5.7,1.6,5.4,1.5,5,1.5
+ c-0.4,0-0.7,0.1-0.9,0.4C3.9,2.1,3.7,2.4,3.7,2.8L2,2.7c0.1-0.4,0.2-0.8,0.3-1.1C2.5,1.2,2.7,0.9,3,0.7c0.3-0.2,0.6-0.4,0.9-0.5
+ S4.7,0,5.1,0c0.4,0,0.8,0.1,1.1,0.2c0.3,0.1,0.6,0.3,0.9,0.5c0.3,0.2,0.4,0.5,0.6,0.8c0.1,0.3,0.2,0.7,0.2,1.1
+ C7.9,2.9,7.8,3.1,7.8,3.4z"/>
+ </g>
+ <g>
+ <rect class="st1" width="10" height="10"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/qt_maximize.svg b/src/widgets/styles/images/qt_maximize.svg
new file mode 100644
index 0000000000..db88025174
--- /dev/null
+++ b/src/widgets/styles/images/qt_maximize.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="10px" viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#343638;}
+</style>
+<g>
+ <path class="st0" d="M9,1v8H1V1H9 M10,0H0v10h10V0L10,0z"/>
+ <rect class="st0" width="10" height="3"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/qt_menu.svg b/src/widgets/styles/images/qt_menu.svg
new file mode 100644
index 0000000000..77c7f23d0c
--- /dev/null
+++ b/src/widgets/styles/images/qt_menu.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="16px" height="16px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#41CD52;}
+ .st1{fill:#FFFFFF;}
+ .st2{fill:none;}
+</style>
+<g>
+ <g>
+ <polygon class="st0" points="2.2,2 2.2,2 0,4.2 0,14 13.8,14 16,11.8 16,2 "/>
+ <path class="st1" d="M6,11.3c-1.1,0-1.8-0.3-2.2-0.9C3.3,9.9,3.1,9,3.1,7.8c0-1.2,0.2-2.1,0.6-2.7S4.9,4.2,6,4.2
+ c1,0,1.8,0.3,2.2,0.9c0.4,0.6,0.6,1.5,0.6,2.7c0,0.8-0.1,1.5-0.3,2c-0.2,0.5-0.5,0.9-0.8,1.1l0.9,1.4l-1,0.5l-0.9-1.5
+ C6.4,11.3,6.2,11.3,6,11.3z M4.6,9.8c0.2,0.4,0.7,0.6,1.3,0.6S7,10.2,7.3,9.8c0.2-0.4,0.3-1,0.3-2c0-0.9-0.1-1.6-0.3-2
+ S6.6,5.2,6,5.2c-0.6,0-1.1,0.2-1.3,0.6c-0.2,0.4-0.4,1.1-0.4,2C4.3,8.7,4.4,9.4,4.6,9.8z"/>
+ <path class="st1" d="M12.7,7h-1.4v2.2c0,0.4,0,0.7,0.1,0.8c0.1,0.1,0.2,0.2,0.5,0.2l0.8,0l0,0.9c-0.5,0.1-0.8,0.1-1,0.1
+ c-0.6,0-1-0.1-1.2-0.4s-0.3-0.8-0.3-1.5V7H9.4V6h0.8V4.6h1.1V6h1.4L12.7,7L12.7,7z"/>
+ </g>
+ <rect class="st2" width="16" height="16"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/qt_minimize.svg b/src/widgets/styles/images/qt_minimize.svg
new file mode 100644
index 0000000000..891e401c37
--- /dev/null
+++ b/src/widgets/styles/images/qt_minimize.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="10px" viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#353637;}
+ .st1{fill:none;}
+</style>
+<g>
+ <rect x="1" y="7" class="st0" width="7" height="2"/>
+ <g>
+ <rect class="st1" width="10" height="10"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/qt_normalizeup.svg b/src/widgets/styles/images/qt_normalizeup.svg
new file mode 100644
index 0000000000..865cebca76
--- /dev/null
+++ b/src/widgets/styles/images/qt_normalizeup.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="10px" viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#353637;}
+ .st1{fill:none;}
+</style>
+<g>
+ <g>
+ <rect x="4" class="st0" width="6" height="2"/>
+ <polygon class="st0" points="4,0 4,5 5,5 5,1 9,1 9,5 7,5 7,6 10,6 10,0 "/>
+ </g>
+ <g>
+ <path class="st0" d="M7,4v4H3V4H7 M8,3H2v6h6V3L8,3z"/>
+ <rect x="2" y="3" class="st0" width="6" height="2"/>
+ </g>
+ <rect class="st1" width="10" height="10"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/qt_shade.svg b/src/widgets/styles/images/qt_shade.svg
new file mode 100644
index 0000000000..e90a86e861
--- /dev/null
+++ b/src/widgets/styles/images/qt_shade.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="10px" viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#353637;}
+ .st1{fill:none;}
+</style>
+<g>
+ <polygon class="st0" points="9,8 1,8 5,3 "/>
+ <g>
+ <rect class="st1" width="10" height="10"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/qt_unshade.svg b/src/widgets/styles/images/qt_unshade.svg
new file mode 100644
index 0000000000..805292cd7f
--- /dev/null
+++ b/src/widgets/styles/images/qt_unshade.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="10px" viewBox="0 0 10 10" style="enable-background:new 0 0 10 10;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#353637;}
+ .st1{fill:none;}
+</style>
+<g>
+ <polygon class="st0" points="1,2 9,2 5,7 "/>
+ <g>
+ <rect class="st1" width="10" height="10"/>
+ </g>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/question-128.png b/src/widgets/styles/images/question-128.png
new file mode 100644
index 0000000000..67748522ad
--- /dev/null
+++ b/src/widgets/styles/images/question-128.png
Binary files differ
diff --git a/src/widgets/styles/images/question-16.png b/src/widgets/styles/images/question-16.png
new file mode 100644
index 0000000000..a907b3c485
--- /dev/null
+++ b/src/widgets/styles/images/question-16.png
Binary files differ
diff --git a/src/widgets/styles/images/question-32.png b/src/widgets/styles/images/question-32.png
new file mode 100644
index 0000000000..96c53c7ce0
--- /dev/null
+++ b/src/widgets/styles/images/question-32.png
Binary files differ
diff --git a/src/widgets/styles/images/question.svg b/src/widgets/styles/images/question.svg
new file mode 100644
index 0000000000..20fafa8941
--- /dev/null
+++ b/src/widgets/styles/images/question.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="32px" height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#46A2DA;}
+ .st1{fill:none;}
+</style>
+<g>
+ <path class="st0" d="M16,4C9.4,4,4,9.4,4,16s5.4,12,12,12s12-5.4,12-12S22.6,4,16,4z M17.4,23.3c-0.3,0.3-0.7,0.5-1.2,0.5
+ c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.2-0.5-0.3c-0.2-0.1-0.3-0.3-0.4-0.5c-0.1-0.2-0.1-0.4-0.1-0.6c0-0.4,0.2-0.8,0.5-1.2
+ c0.3-0.3,0.7-0.5,1.2-0.5c0.4,0,0.8,0.2,1.2,0.5c0.3,0.3,0.5,0.7,0.5,1.1C17.9,22.6,17.7,22.9,17.4,23.3z M20.7,13.7
+ c-0.1,0.4-0.3,0.7-0.5,1c-0.2,0.3-0.5,0.6-0.7,0.8c-0.3,0.3-0.6,0.5-0.9,0.8c-0.2,0.2-0.4,0.3-0.5,0.5c-0.1,0.1-0.3,0.3-0.3,0.4
+ c-0.1,0.1-0.2,0.3-0.2,0.5c0,0.2-0.1,0.4-0.1,0.7v0.8h-2.5v-1.2c0-0.3,0-0.6,0.1-0.8c0-0.2,0.1-0.4,0.2-0.6
+ c0.1-0.2,0.2-0.3,0.4-0.5c0.1-0.2,0.3-0.4,0.5-0.6l1.6-1.6c0.3-0.4,0.5-0.8,0.5-1.4c0-0.5-0.2-1-0.5-1.3c-0.4-0.3-0.8-0.5-1.4-0.5
+ c-0.6,0-1.1,0.2-1.5,0.6c-0.4,0.4-0.6,0.9-0.7,1.5l-2.7-0.2c0.1-0.7,0.3-1.3,0.5-1.8c0.3-0.5,0.6-1,1-1.3c0.4-0.4,0.9-0.6,1.5-0.8
+ c0.6-0.2,1.2-0.3,1.8-0.3c0.6,0,1.2,0.1,1.8,0.3c0.5,0.2,1,0.4,1.4,0.8c0.4,0.3,0.7,0.8,0.9,1.3c0.2,0.5,0.3,1.1,0.3,1.8
+ C20.8,12.9,20.8,13.3,20.7,13.7z"/>
+ <rect class="st1" width="32" height="32"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/standardbutton-closetab-128.png b/src/widgets/styles/images/standardbutton-closetab-128.png
new file mode 100644
index 0000000000..aca55c8424
--- /dev/null
+++ b/src/widgets/styles/images/standardbutton-closetab-128.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-16.png b/src/widgets/styles/images/standardbutton-closetab-16.png
index 540694eae3..26908feb2a 100644
--- a/src/widgets/styles/images/standardbutton-closetab-16.png
+++ b/src/widgets/styles/images/standardbutton-closetab-16.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-32.png b/src/widgets/styles/images/standardbutton-closetab-32.png
index 93e1246b47..effcc89eed 100644
--- a/src/widgets/styles/images/standardbutton-closetab-32.png
+++ b/src/widgets/styles/images/standardbutton-closetab-32.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-down-128.png b/src/widgets/styles/images/standardbutton-closetab-down-128.png
new file mode 100644
index 0000000000..2efdfd053f
--- /dev/null
+++ b/src/widgets/styles/images/standardbutton-closetab-down-128.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-down-16.png b/src/widgets/styles/images/standardbutton-closetab-down-16.png
index ccec241652..5228c1573b 100644
--- a/src/widgets/styles/images/standardbutton-closetab-down-16.png
+++ b/src/widgets/styles/images/standardbutton-closetab-down-16.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-down-32.png b/src/widgets/styles/images/standardbutton-closetab-down-32.png
index 343b72586e..dfd88920ab 100644
--- a/src/widgets/styles/images/standardbutton-closetab-down-32.png
+++ b/src/widgets/styles/images/standardbutton-closetab-down-32.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-down.svg b/src/widgets/styles/images/standardbutton-closetab-down.svg
new file mode 100644
index 0000000000..12aa6b21f7
--- /dev/null
+++ b/src/widgets/styles/images/standardbutton-closetab-down.svg
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="32px"
+ height="32px"
+ viewBox="0 0 32 32"
+ style="enable-background:new 0 0 32 32;"
+ xml:space="preserve"
+ sodipodi:docname="standardbutton-closetab-down.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="16.572815"
+ inkscape:cx="28.732573"
+ inkscape:cy="14.492458"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g8" />
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:#46A2DA;}
+ .st1{fill:none;}
+</style>
+<g
+ id="g8">
+
+
+<rect
+ style="fill:#b17153;stroke:#b17153;stroke-width:1.99804;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect17-3"
+ width="22.001965"
+ height="22.001963"
+ x="4.9990177"
+ y="4.9990177"
+ rx="0"
+ ry="0" /><rect
+ style="fill:none;stroke:#ab493f;stroke-width:1.99992;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect17"
+ width="26.000072"
+ height="26.000076"
+ x="2.9999642"
+ y="2.9999642"
+ rx="1.792347"
+ ry="1.7923476" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.76951;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1031"
+ width="3"
+ height="16"
+ x="21.127417"
+ y="-8"
+ transform="rotate(45)" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.76951;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1031-6"
+ width="3"
+ height="16"
+ x="-1.5"
+ y="14.627417"
+ transform="rotate(-45)" /></g>
+</svg>
diff --git a/src/widgets/styles/images/standardbutton-closetab-hover-128.png b/src/widgets/styles/images/standardbutton-closetab-hover-128.png
new file mode 100644
index 0000000000..4f6b1bfde4
--- /dev/null
+++ b/src/widgets/styles/images/standardbutton-closetab-hover-128.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-hover-16.png b/src/widgets/styles/images/standardbutton-closetab-hover-16.png
index b22a0ffaf0..460411deeb 100644
--- a/src/widgets/styles/images/standardbutton-closetab-hover-16.png
+++ b/src/widgets/styles/images/standardbutton-closetab-hover-16.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-hover-32.png b/src/widgets/styles/images/standardbutton-closetab-hover-32.png
index 41ce0265c7..aa6afd72b2 100644
--- a/src/widgets/styles/images/standardbutton-closetab-hover-32.png
+++ b/src/widgets/styles/images/standardbutton-closetab-hover-32.png
Binary files differ
diff --git a/src/widgets/styles/images/standardbutton-closetab-hover.svg b/src/widgets/styles/images/standardbutton-closetab-hover.svg
new file mode 100644
index 0000000000..45dc8b8c46
--- /dev/null
+++ b/src/widgets/styles/images/standardbutton-closetab-hover.svg
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="32px"
+ height="32px"
+ viewBox="0 0 32 32"
+ style="enable-background:new 0 0 32 32;"
+ xml:space="preserve"
+ sodipodi:docname="standardbutton-closetab-hover.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="16.572815"
+ inkscape:cx="33.318396"
+ inkscape:cy="14.492458"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g8"
+ inkscape:document-rotation="0" />
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:#46A2DA;}
+ .st1{fill:none;}
+</style>
+<g
+ id="g8">
+
+
+<rect
+ style="fill:#ea8f60;stroke:#f2b7a7;stroke-width:1.99804;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect17-3"
+ width="22.001965"
+ height="22.001963"
+ x="4.9990177"
+ y="4.9990177"
+ rx="0"
+ ry="0" /><rect
+ style="fill:none;stroke:#d73727;stroke-width:1.99992;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect17"
+ width="26.000072"
+ height="26.000076"
+ x="2.9999642"
+ y="2.9999642"
+ rx="1.792347"
+ ry="1.7923476" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.76951;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1031"
+ width="3"
+ height="16"
+ x="21.127417"
+ y="-8"
+ transform="rotate(45)" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.76951;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1031-6"
+ width="3"
+ height="16"
+ x="-1.5"
+ y="14.627417"
+ transform="rotate(-45)" /></g>
+</svg>
diff --git a/src/widgets/styles/images/standardbutton-closetab.svg b/src/widgets/styles/images/standardbutton-closetab.svg
new file mode 100644
index 0000000000..d3a9279538
--- /dev/null
+++ b/src/widgets/styles/images/standardbutton-closetab.svg
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="32px"
+ height="32px"
+ viewBox="0 0 32 32"
+ style="enable-background:new 0 0 32 32;"
+ xml:space="preserve"
+ sodipodi:docname="standardbutton-closetab.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"><metadata
+ id="metadata15"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs13" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="918"
+ id="namedview11"
+ showgrid="false"
+ inkscape:zoom="16.572815"
+ inkscape:cx="33.318396"
+ inkscape:cy="14.492458"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="g8"
+ inkscape:document-rotation="0" />
+<style
+ type="text/css"
+ id="style2">
+ .st0{fill:#46A2DA;}
+ .st1{fill:none;}
+</style>
+<g
+ id="g8">
+
+
+<rect
+ style="fill:#ea8f60;stroke:#ef9d8e;stroke-width:1.99804;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
+ id="rect17-3"
+ width="22.001965"
+ height="22.001963"
+ x="4.9990177"
+ y="4.9990177"
+ rx="0"
+ ry="0" /><rect
+ style="fill:none;stroke:#d73727;stroke-width:1.99992;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect17"
+ width="26.000072"
+ height="26.000076"
+ x="2.9999642"
+ y="2.9999642"
+ rx="1.792347"
+ ry="1.7923476" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.76951;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1031"
+ width="3"
+ height="16"
+ x="21.127417"
+ y="-8"
+ transform="rotate(45)" /><rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.76951;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1031-6"
+ width="3"
+ height="16"
+ x="-1.5"
+ y="14.627417"
+ transform="rotate(-45)" /></g>
+</svg>
diff --git a/src/widgets/styles/images/toolbar-ext-h-128.png b/src/widgets/styles/images/toolbar-ext-h-128.png
new file mode 100644
index 0000000000..071c5b1353
--- /dev/null
+++ b/src/widgets/styles/images/toolbar-ext-h-128.png
Binary files differ
diff --git a/src/widgets/styles/images/toolbar-ext-h-rtl-128.png b/src/widgets/styles/images/toolbar-ext-h-rtl-128.png
new file mode 100644
index 0000000000..7aadfc2aea
--- /dev/null
+++ b/src/widgets/styles/images/toolbar-ext-h-rtl-128.png
Binary files differ
diff --git a/src/widgets/styles/images/toolbar-ext-h.svg b/src/widgets/styles/images/toolbar-ext-h.svg
new file mode 100644
index 0000000000..203b77625e
--- /dev/null
+++ b/src/widgets/styles/images/toolbar-ext-h.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="8px" height="5px" viewBox="0 0 8 5" style="enable-background:new 0 0 8 5;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#353637;}
+ .st1{fill:none;}
+</style>
+<g>
+ <g>
+ <path class="st0" d="M4.2,2.6L2.2,5L1.5,4.6l1.7-2.1L1.5,0.4L2.2,0l2,2.4V2.6z M7.6,2.6L5.6,5L4.9,4.6l1.7-2.1L4.9,0.4L5.6,0
+ l2,2.4V2.6z"/>
+ </g>
+ <rect class="st1" width="8" height="5"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/toolbar-ext-v-80.png b/src/widgets/styles/images/toolbar-ext-v-80.png
new file mode 100644
index 0000000000..84d15ff064
--- /dev/null
+++ b/src/widgets/styles/images/toolbar-ext-v-80.png
Binary files differ
diff --git a/src/widgets/styles/images/toolbar-ext-v.svg b/src/widgets/styles/images/toolbar-ext-v.svg
new file mode 100644
index 0000000000..ba2eac25ee
--- /dev/null
+++ b/src/widgets/styles/images/toolbar-ext-v.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="5px" height="8px" viewBox="0 0 5 8" style="enable-background:new 0 0 5 8;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#353637;}
+ .st1{fill:none;}
+</style>
+<g>
+ <g>
+ <path class="st0" d="M2.4,4.2L0,2.2l0.4-0.7l2.1,1.7l2.1-1.7L5,2.2l-2.4,2H2.4z M2.4,7.6L0,5.6l0.4-0.7l2.1,1.7l2.1-1.7L5,5.6
+ l-2.4,2H2.4z"/>
+ </g>
+ <rect x="-1.5" y="1.5" transform="matrix(-1.836970e-16 1 -1 -1.836970e-16 6.5 1.5)" class="st1" width="8" height="5"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/images/warning-128.png b/src/widgets/styles/images/warning-128.png
new file mode 100644
index 0000000000..07f0251b8a
--- /dev/null
+++ b/src/widgets/styles/images/warning-128.png
Binary files differ
diff --git a/src/widgets/styles/images/warning-16.png b/src/widgets/styles/images/warning-16.png
new file mode 100644
index 0000000000..dce3ac9126
--- /dev/null
+++ b/src/widgets/styles/images/warning-16.png
Binary files differ
diff --git a/src/widgets/styles/images/warning-32.png b/src/widgets/styles/images/warning-32.png
new file mode 100644
index 0000000000..a7b822737d
--- /dev/null
+++ b/src/widgets/styles/images/warning-32.png
Binary files differ
diff --git a/src/widgets/styles/images/warning.svg b/src/widgets/styles/images/warning.svg
new file mode 100644
index 0000000000..5f6994ab33
--- /dev/null
+++ b/src/widgets/styles/images/warning.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="32px" height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#FACE20;}
+ .st1{fill:none;}
+</style>
+<g>
+ <g>
+ <path class="st0" d="M17,4h-2L4,26v2h24v-2L17,4z M16,26c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S17.1,26,16,26z M17.4,20h-2.8
+ L14,10h4L17.4,20z"/>
+ </g>
+ <rect class="st1" width="32" height="32"/>
+</g>
+</svg>
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 358edc230b..418a0c2c5f 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qcommonstyle.h"
#include "qcommonstyle_p.h"
@@ -114,6 +78,8 @@
#include <private/qstyleanimation_p.h>
#endif
+#include <qloggingcategory.h>
+
#include <limits.h>
#include <private/qtextengine_p.h>
@@ -121,34 +87,39 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcCommonStyle, "qt.widgets.commonstyle");
+
+using namespace Qt::StringLiterals;
+
static qreal qt_getDevicePixelRatio(const QWidget *widget)
{
return widget ? widget->devicePixelRatio() : qApp->devicePixelRatio();
}
-static QIcon tabBarCloseButtonIcon()
+struct QPainterStateSaver
{
- QIcon result;
- result.addPixmap(QPixmap(
- QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-16.png")),
- QIcon::Normal, QIcon::Off);
- result.addPixmap(QPixmap(
- QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-32.png")),
- QIcon::Normal, QIcon::Off);
- result.addPixmap(QPixmap(
- QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-16.png")),
- QIcon::Normal, QIcon::On);
- result.addPixmap(QPixmap(
- QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-32.png")),
- QIcon::Normal, QIcon::On);
- result.addPixmap(QPixmap(
- QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-16.png")),
- QIcon::Active, QIcon::Off);
- result.addPixmap(QPixmap(
- QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-32.png")),
- QIcon::Active, QIcon::Off);
- return result;
-}
+ QPainterStateSaver(QPainter *p, bool bSaveRestore = true)
+ : m_painter(p)
+ , m_bSaveRestore(bSaveRestore)
+ {
+ if (m_bSaveRestore)
+ m_painter->save();
+ }
+ ~QPainterStateSaver()
+ {
+ restore();
+ }
+ void restore()
+ {
+ if (m_bSaveRestore) {
+ m_bSaveRestore = false;
+ m_painter->restore();
+ }
+ }
+private:
+ QPainter *m_painter;
+ bool m_bSaveRestore;
+};
/*!
\class QCommonStyle
@@ -243,20 +214,19 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
case PE_FrameFocusRect:
if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
QColor bg = fropt->backgroundColor;
- QPen oldPen = p->pen();
+ QColor color;
if (bg.isValid()) {
int h, s, v;
bg.getHsv(&h, &s, &v);
if (v >= 128)
- p->setPen(Qt::black);
+ color = Qt::black;
else
- p->setPen(Qt::white);
+ color = Qt::white;
} else {
- p->setPen(opt->palette.windowText().color());
+ color = opt->palette.windowText().color();
}
- QRect focusRect = opt->rect.adjusted(1, 1, -1, -1);
- p->drawRect(focusRect.adjusted(0, 0, -1, -1)); //draw pen inclusive
- p->setPen(oldPen);
+ const QRect focusRect = opt->rect.adjusted(1, 1, -1, -1);
+ qDrawPlainRect(p, focusRect, color, 1);
}
break;
case PE_IndicatorMenuCheckMark: {
@@ -283,11 +253,10 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
--yy;
}
if (!(opt->state & State_Enabled) && !(opt->state & State_On)) {
- p->save();
+ QPainterStateSaver pss(p);
p->translate(1, 1);
p->setPen(opt->palette.light().color());
p->drawLines(a);
- p->restore();
}
p->setPen((opt->state & State_On) ? opt->palette.highlightedText().color() : opt->palette.text().color());
p->drawLines(a);
@@ -409,7 +378,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
case PE_FrameTabBarBase:
if (const QStyleOptionTabBarBase *tbb
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
- p->save();
+ QPainterStateSaver pss(p);
switch (tbb->shape) {
case QTabBar::RoundedNorth:
case QTabBar::TriangularNorth:
@@ -436,14 +405,13 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight());
break;
}
- p->restore();
}
break;
case PE_IndicatorTabClose: {
if (d->tabBarcloseButtonIcon.isNull())
- d->tabBarcloseButtonIcon = tabBarCloseButtonIcon();
+ d->tabBarcloseButtonIcon = proxy()->standardIcon(QStyle::SP_TabCloseButton, opt, widget);
- const int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize, opt);
+ const int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize, opt, widget);
QIcon::Mode mode = opt->state & State_Enabled ?
(opt->state & State_Raised ? QIcon::Active : QIcon::Normal)
: QIcon::Disabled;
@@ -489,15 +457,15 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
int lw = frame->lineWidth;
if (lw <= 0)
- lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, opt);
+ lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, opt, widget);
qDrawShadePanel(p, frame->rect, frame->palette, false, lw);
}
break;
#endif // QT_CONFIG(dockwidget)
#if QT_CONFIG(toolbar)
- case PE_IndicatorToolBarHandle:
- p->save();
+ case PE_IndicatorToolBarHandle: {
+ QPainterStateSaver pss(p);
p->translate(opt->rect.x(), opt->rect.y());
if (opt->state & State_Horizontal) {
int x = opt->rect.width() / 3;
@@ -518,8 +486,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
opt->palette, false, 1, nullptr);
}
}
- p->restore();
break;
+ }
case PE_IndicatorToolBarSeparator:
{
QPoint p1, p2;
@@ -540,24 +508,58 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
QRect r = opt->rect;
int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
QRect br = r.adjusted(fw, fw, -fw, -fw);
-
- int offset = (opt->state & State_Sunken) ? 1 : 0;
- int step = (br.width() + 4) / 5;
- p->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2,
- br.width(), step,
- opt->palette.buttonText());
+ int x = br.x();
+ int y = br.y();
+ int w = br.width();
+ int h = br.height();
+ QPainterStateSaver pss(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatio();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ p->translate(0.5, 0.5);
+ }
+ int len = std::min(w, h);
+ if (len & 1)
+ ++len;
+ int step = (len + 4) / 5;
+ if (step & 1)
+ ++step;
+ const int step2 = step / 2;
+ QPoint center(x + w / 2, y + h / 2);
+ if (opt->state & State_Sunken) {
+ center += QPoint(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget));
+ }
+ p->translate(center);
+ p->fillRect(-len / 2, -step2, len, step, opt->palette.buttonText());
if (pe == PE_IndicatorSpinPlus)
- p->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset,
- step, br.height(),
- opt->palette.buttonText());
-
+ p->fillRect(-step2, -len / 2, step, len, opt->palette.buttonText());
break; }
case PE_IndicatorSpinUp:
case PE_IndicatorSpinDown: {
QRect r = opt->rect;
int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
// QRect br = r.adjusted(fw, fw, -fw, -fw);
- int x = r.x(), y = r.y(), w = r.width(), h = r.height();
+ int x = r.x();
+ int y = r.y();
+ int w = r.width();
+ int h = r.height();
+ QPainterStateSaver pss(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatio();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = qRound(devicePixelRatio * w);
+ h = qRound(devicePixelRatio * h);
+ p->translate(0.5, 0.5);
+ }
int sw = w-4;
if (sw < 3)
break;
@@ -575,10 +577,9 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
int bsx = 0;
int bsy = 0;
if (opt->state & State_Sunken) {
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget);
}
- p->save();
p->translate(sx + bsx, sy + bsy);
p->setPen(opt->palette.buttonText().color());
p->setBrush(opt->palette.buttonText());
@@ -589,7 +590,6 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
const QPoint points[] = { QPoint(0, sh-1), QPoint(sw-1, sh-1), QPoint(sh-2, 1) };
p->drawPolygon(points, sizeof points / sizeof *points);
}
- p->restore();
break; }
#endif // QT_CONFIG(spinbox)
case PE_PanelTipLabel: {
@@ -647,7 +647,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
case PE_IndicatorColumnViewArrow: {
if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
bool reverse = (viewOpt->direction == Qt::RightToLeft);
- p->save();
+ QPainterStateSaver pss(p);
QPainterPath path;
int x = viewOpt->rect.x() + 1;
int offset = (viewOpt->rect.height() / 3);
@@ -692,7 +692,6 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->setPen(color);
p->drawPath(lines);
}
- p->restore();
}
break; }
#endif //QT_CONFIG(columnview)
@@ -711,7 +710,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
cg = QPalette::Inactive;
- if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget))
+ if ((vopt->state & QStyle::State_Selected) && vopt->showDecorationSelected)
p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight));
else if (vopt->features & QStyleOptionViewItem::Alternate)
p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
@@ -751,35 +750,36 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
case PE_IndicatorArrowRight:
case PE_IndicatorArrowLeft:
{
- if (opt->rect.width() <= 1 || opt->rect.height() <= 1)
+ const QRect &r = opt->rect;
+ if (r.width() <= 1 || r.height() <= 1)
break;
- QRect r = opt->rect;
int size = qMin(r.height(), r.width());
QPixmap pixmap;
- QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-")
- % QLatin1String(metaObject()->className()), opt, QSize(size, size))
- % HexString<uint>(pe);
+ const qreal dpr = p->device()->devicePixelRatio();
+ const QString pixmapName = QStyleHelper::uniqueName("$qt_ia-"_L1
+ % QLatin1StringView(metaObject()->className())
+ % HexString<uint>(pe),
+ opt, QSize(size, size), dpr);
if (!QPixmapCache::find(pixmapName, &pixmap)) {
- qreal pixelRatio = p->device()->devicePixelRatio();
- int border = qRound(pixelRatio*(size/5));
- int sqsize = qRound(pixelRatio*(2*(size/2)));
- QImage image(sqsize, sqsize, QImage::Format_ARGB32_Premultiplied);
- image.fill(0);
- QPainter imagePainter(&image);
-
- QPolygon a;
+ const qreal border = size / 5.;
+ const qreal sqsize = size;
+ pixmap = styleCachePixmap(QSize(size, size), dpr);
+ QPainter imagePainter(&pixmap);
+ imagePainter.setRenderHint(QPainter::Antialiasing);
+
+ QPolygonF poly;
switch (pe) {
case PE_IndicatorArrowUp:
- a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2);
+ poly = {QPointF(border, sqsize / 2), QPointF(sqsize / 2, border), QPointF(sqsize - border, sqsize / 2)};
break;
case PE_IndicatorArrowDown:
- a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2);
+ poly = {QPointF(border, sqsize / 2), QPointF(sqsize / 2, sqsize - border), QPointF(sqsize - border, sqsize / 2)};
break;
case PE_IndicatorArrowRight:
- a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
+ poly = {QPointF(sqsize - border, sqsize / 2), QPointF(sqsize / 2, border), QPointF(sqsize / 2, sqsize - border)};
break;
case PE_IndicatorArrowLeft:
- a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border);
+ poly = {QPointF(border, sqsize / 2), QPointF(sqsize / 2, border), QPointF(sqsize / 2, sqsize - border)};
break;
default:
break;
@@ -793,9 +793,9 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget);
}
- QRect bounds = a.boundingRect();
- int sx = sqsize / 2 - bounds.center().x() - 1;
- int sy = sqsize / 2 - bounds.center().y() - 1;
+ const QPointF boundsCenter = poly.boundingRect().center();
+ const qreal sx = sqsize / 2 - boundsCenter.x();
+ const qreal sy = sqsize / 2 - boundsCenter.y();
imagePainter.translate(sx + bsx, sy + bsy);
imagePainter.setPen(opt->palette.buttonText().color());
imagePainter.setBrush(opt->palette.buttonText());
@@ -804,16 +804,14 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
imagePainter.translate(1, 1);
imagePainter.setBrush(opt->palette.light().color());
imagePainter.setPen(opt->palette.light().color());
- imagePainter.drawPolygon(a);
+ imagePainter.drawPolygon(poly);
imagePainter.translate(-1, -1);
imagePainter.setBrush(opt->palette.mid().color());
imagePainter.setPen(opt->palette.mid().color());
}
- imagePainter.drawPolygon(a);
+ imagePainter.drawPolygon(poly);
imagePainter.end();
- pixmap = QPixmap::fromImage(image);
- pixmap.setDevicePixelRatio(pixelRatio);
QPixmapCache::insert(pixmapName, pixmap);
}
int xOffset = r.x() + (r.width() - size)/2;
@@ -993,18 +991,27 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
break;
}
case QStyleOptionViewItem::Top:
- case QStyleOptionViewItem::Bottom:
- if (wrapText)
- bounds.setWidth(bounds.isValid() ? bounds.width() - 2 * textMargin : option->decorationSize.width());
- else
- bounds.setWidth(QFIXED_MAX);
+ case QStyleOptionViewItem::Bottom: {
+ int width;
+ if (wrapText) {
+ if (bounds.isValid())
+ width = bounds.width() - 2 * textMargin;
+ else if (option->features & QStyleOptionViewItem::HasDecoration)
+ width = option->decorationSize.width();
+ else
+ width = 0;
+ } else {
+ width = QFIXED_MAX;
+ }
+ bounds.setWidth(width);
break;
+ }
default:
break;
}
if (wrapText && option->features & QStyleOptionViewItem::HasCheckIndicator)
- bounds.setWidth(bounds.width() - proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option) - 2 * textMargin);
+ bounds.setWidth(bounds.width() - proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget) - 2 * textMargin);
const int lineWidth = bounds.width();
const QSizeF size = viewItemTextLayout(textLayout, lineWidth);
@@ -1160,7 +1167,7 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItem *opt, QRect
}
break; }
default:
- qWarning("doLayout: decoration position is invalid");
+ qCWarning(lcCommonStyle, "doLayout: decoration position is invalid");
decoration = *pixmapRect;
break;
}
@@ -1170,12 +1177,8 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItem *opt, QRect
checkRect->size(), check);
*pixmapRect = QStyle::alignedRect(opt->direction, opt->decorationAlignment,
pixmapRect->size(), decoration);
- // the text takes up all available space, unless the decoration is not shown as selected
- if (opt->showDecorationSelected)
- *textRect = display;
- else
- *textRect = QStyle::alignedRect(opt->direction, opt->displayAlignment,
- textRect->size().boundedTo(display.size()), display);
+ // the textRect takes up all remaining size
+ *textRect = display;
} else {
*checkRect = check;
*pixmapRect = decoration;
@@ -1250,7 +1253,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
if (!opt->icon.isNull()) {
QSize iconSize = opt->iconSize;
if (!iconSize.isValid()) {
- int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize, opt);
+ int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize, opt, widget);
iconSize = QSize(iconExtent, iconExtent);
}
QSize tabIconSize = opt->icon.actualSize(iconSize,
@@ -1276,12 +1279,6 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
#if QT_CONFIG(animation)
/*! \internal */
-QList<const QObject*> QCommonStylePrivate::animationTargets() const
-{
- return animations.keys();
-}
-
-/*! \internal */
QStyleAnimation * QCommonStylePrivate::animation(const QObject *target) const
{
return animations.value(target);
@@ -1291,9 +1288,11 @@ QStyleAnimation * QCommonStylePrivate::animation(const QObject *target) const
void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const
{
Q_Q(const QCommonStyle);
- stopAnimation(animation->target());
- q->connect(animation, SIGNAL(destroyed()), SLOT(_q_removeAnimation()), Qt::UniqueConnection);
- animations.insert(animation->target(), animation);
+ const auto target = animation->target();
+ stopAnimation(target);
+ QObject::connect(animation, &QStyleAnimation::destroyed,
+ q, [this, target]() { removeAnimation(target); });
+ animations.insert(target, animation);
animation->start();
}
@@ -1308,12 +1307,9 @@ void QCommonStylePrivate::stopAnimation(const QObject *target) const
}
/*! \internal */
-void QCommonStylePrivate::_q_removeAnimation()
+void QCommonStylePrivate::removeAnimation(const QObject *target) const
{
- Q_Q(QCommonStyle);
- QObject *animation = q->sender();
- if (animation)
- animations.remove(animation->parent());
+ animations.remove(target);
}
#endif
@@ -1368,7 +1364,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_PushButtonLabel:
if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
QRect textRect = button->rect;
- uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
+ int tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
if (!proxy()->styleHint(SH_UnderlineShortcut, button, widget))
tf |= Qt::TextHideMnemonic;
@@ -1406,13 +1402,16 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
iconRect = visualRect(button->direction, textRect, iconRect);
- if (button->direction == Qt::RightToLeft) {
- tf |= Qt::AlignRight;
+ if (button->direction == Qt::RightToLeft)
textRect.setRight(iconRect.left() - iconSpacing / 2);
- } else {
- tf |= Qt::AlignLeft; //left align, we adjust the text-rect instead
+ else
textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing / 2);
- }
+
+ // qt_format_text reverses again when painter->layoutDirection is also RightToLeft
+ if (p->layoutDirection() == button->direction)
+ tf |= Qt::AlignLeft;
+ else
+ tf |= Qt::AlignRight;
if (button->state & (State_On | State_Sunken))
iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
@@ -1453,7 +1452,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_RadioButtonLabel:
case CE_CheckBoxLabel:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
- uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter);
+ int alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter);
if (!proxy()->styleHint(SH_UnderlineShortcut, btn, widget))
alignment |= Qt::TextHideMnemonic;
@@ -1497,11 +1496,11 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
#if QT_CONFIG(menubar)
case CE_MenuBarItem:
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
- uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
- | Qt::TextSingleLine;
+ int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
+ | Qt::TextSingleLine;
if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
alignment |= Qt::TextHideMnemonic;
- int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt);
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
QPixmap pix = mbi->icon.pixmap(QSize(iconExtent, iconExtent), p->device()->devicePixelRatio(), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
if (!pix.isNull())
proxy()->drawItemPixmap(p,mbi->rect, alignment, pix);
@@ -1657,7 +1656,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
QRect rect = header->rect;
if (!header->icon.isNull()) {
- int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt);
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
QPixmap pixmap
= header->icon.pixmap(QSize(iconExtent, iconExtent), p->device()->devicePixelRatio(), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
int pixw = pixmap.width() / pixmap.devicePixelRatio();
@@ -1678,9 +1677,12 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QFontMetrics fm(header->fontMetrics);
if (header->state & QStyle::State_On) {
QFont fnt = p->font();
- fnt.setBold(true);
- p->setFont(fnt);
- fm = QFontMetrics((p->font()));
+ // the font already has a weight set; don't override that
+ if (!(fnt.resolveMask() & QFont::WeightResolved)) {
+ fnt.setBold(true);
+ p->setFont(fnt);
+ fm = QFontMetrics((p->font()));
+ }
}
QString text = header->text;
if (const QStyleOptionHeaderV2 *headerV2 = qstyleoption_cast<const QStyleOptionHeaderV2 *>(header)) {
@@ -1711,8 +1713,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
alignment |= Qt::TextHideMnemonic;
rect.translate(shiftX, shiftY);
p->setFont(toolbutton->font);
+ const QString text = d->toolButtonElideText(toolbutton, rect, alignment);
proxy()->drawItemText(p, rect, alignment, toolbutton->palette,
- opt->state & State_Enabled, toolbutton->text,
+ opt->state & State_Enabled, text,
QPalette::ButtonText);
} else {
QPixmap pm;
@@ -1836,8 +1839,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
break;
case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
- p->save();
-
+ QPainterStateSaver pss(p);
QRect rect(tab->rect);
bool selected = tab->state & State_Selected;
bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
@@ -1938,7 +1940,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
default:
break;
}
- p->restore();
}
break;
case CE_ToolBoxTabLabel:
@@ -1999,8 +2000,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
alignment |= Qt::TextHideMnemonic;
+ QPainterStateSaver pss(p, verticalTabs);
if (verticalTabs) {
- p->save();
int newX, newY, newRot;
if (tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::TriangularEast) {
newX = tr.width() + tr.x();
@@ -2017,7 +2018,10 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
QRect iconRect;
d->tabLayout(tab, widget, &tr, &iconRect);
- tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget); //we compute tr twice because the style may override subElementRect
+
+ // compute tr again, unless tab is moving, because the style may override subElementRect
+ if (tab->position != QStyleOptionTab::TabPosition::Moving)
+ tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget);
if (!tab->icon.isNull()) {
QPixmap tabIcon = tab->icon.pixmap(tab->iconSize, p->device()->devicePixelRatio(),
@@ -2028,12 +2032,12 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon);
}
- proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
- if (verticalTabs)
- p->restore();
+ proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text,
+ widget ? widget->foregroundRole() : QPalette::WindowText);
+ pss.restore();
if (tab->state & State_HasFocus) {
- const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth);
+ const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth, opt, widget);
int x1, x2;
x1 = tab->rect.left();
@@ -2050,7 +2054,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
#endif // QT_CONFIG(tabbar)
#if QT_CONFIG(sizegrip)
case CE_SizeGrip: {
- p->save();
+ QPainterStateSaver pss(p);
int x, y, w, h;
opt->rect.getRect(&x, &y, &w, &h);
@@ -2119,7 +2123,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
sy += s;
}
}
- p->restore();
break; }
#endif // QT_CONFIG(sizegrip)
#if QT_CONFIG(rubberband)
@@ -2136,7 +2139,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
// ### workaround for borked XRENDER
tiledPixmap = QPixmap::fromImage(tiledPixmap.toImage());
- p->save();
+ QPainterStateSaver pss(p);
QRect r = opt->rect;
QStyleHintReturnMask mask;
if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
@@ -2147,7 +2150,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->drawRect(r.adjusted(0, 0, -1, -1));
if (rbOpt->shape == QRubberBand::Rectangle)
p->drawRect(r.adjusted(3, 3, -4, -4));
- p->restore();
}
break; }
#endif // QT_CONFIG(rubberband)
@@ -2163,10 +2165,10 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (!dwOpt->title.isEmpty()) {
const bool verticalTitleBar = dwOpt->verticalTitleBar;
+ QPainterStateSaver pss(p, verticalTitleBar);
if (verticalTitleBar) {
r = r.transposed();
- p->save();
p->translate(r.left(), r.top() + r.width());
p->rotate(-90);
p->translate(-r.left(), -r.top());
@@ -2174,12 +2176,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
const int indent = p->fontMetrics().descent();
proxy()->drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1),
- Qt::AlignLeft | Qt::AlignVCenter, dwOpt->palette,
+ Qt::AlignLeft | Qt::AlignVCenter | Qt::TextHideMnemonic, dwOpt->palette,
dwOpt->state & State_Enabled, dwOpt->title,
QPalette::WindowText);
-
- if (verticalTitleBar)
- p->restore();
}
}
break;
@@ -2189,7 +2188,13 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QRegion clipRegion = p->clipRegion();
p->setClipRect(opt->rect);
proxy()->drawControl(CE_HeaderSection, header, p, widget);
- QStyleOptionHeader subopt = *header;
+ // opt can be a QStyleOptionHeaderV2 and we must pass it to the subcontrol drawings
+ QStyleOptionHeaderV2 subopt;
+ QStyleOptionHeader &v1Copy = subopt;
+ if (auto v2 = qstyleoption_cast<const QStyleOptionHeaderV2 *>(opt))
+ subopt = *v2;
+ else
+ v1Copy = *header;
subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
if (subopt.rect.isValid())
proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget);
@@ -2215,7 +2220,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_ComboBoxLabel:
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
- p->save();
+ QPainterStateSaver pss(p);
p->setClipRect(editRect);
if (!cb->currentIcon.isNull()) {
QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
@@ -2240,7 +2245,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
visualAlignment(cb->direction, cb->textAlignment),
cb->palette, cb->state & State_Enabled, cb->currentText);
}
- p->restore();
}
break;
#endif // QT_CONFIG(combobox)
@@ -2286,8 +2290,10 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
#if QT_CONFIG(itemviews)
case CE_ItemViewItem:
if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
- p->save();
- p->setClipRect(opt->rect);
+ QPainterStateSaver pss(p);
+ // the style calling this might want to clip, so respect any region already set
+ const QRegion clipRegion = p->hasClipping() ? (p->clipRegion() & opt->rect) : opt->rect;
+ p->setClipRegion(clipRegion);
QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget);
@@ -2358,8 +2364,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
? QPalette::Highlight : QPalette::Window);
proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget);
}
-
- p->restore();
}
break;
@@ -2609,7 +2613,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
const bool vertical = !(pb->state & QStyle::State_Horizontal);
if (!vertical) {
if (pb->textVisible)
- textw = qMax(pb->fontMetrics.horizontalAdvance(pb->text), pb->fontMetrics.horizontalAdvance(QLatin1String("100%"))) + 6;
+ textw = qMax(pb->fontMetrics.horizontalAdvance(pb->text), pb->fontMetrics.horizontalAdvance("100%"_L1)) + 6;
}
if ((pb->textAlignment & Qt::AlignCenter) == 0) {
@@ -3281,7 +3285,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
int fudge = len / 2;
int pos;
// Since there is no subrect for tickmarks do a translation here.
- p->save();
+ QPainterStateSaver pss(p);
p->translate(slider->rect.x(), slider->rect.y());
p->setPen(slider->palette.windowText().color());
int v = slider->minimum;
@@ -3310,7 +3314,6 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
break;
v = nextInterval;
}
- p->restore();
}
}
break;
@@ -3576,12 +3579,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
tool.state = down ? State_Sunken : State_Raised;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
- p->save();
+ QPainterStateSaver pss(p, down);
if (down)
p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
if (tb->subControls & SC_TitleBarMaxButton
@@ -3595,12 +3597,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
tool.state = down ? State_Sunken : State_Raised;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
- p->save();
+ QPainterStateSaver pss(p, down);
if (down)
p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
if (tb->subControls & SC_TitleBarMinButton
@@ -3613,12 +3614,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
tool.state = down ? State_Sunken : State_Raised;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
- p->save();
+ QPainterStateSaver pss(p, down);
if (down)
p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
bool drawNormalButton = (tb->subControls & SC_TitleBarNormalButton)
@@ -3635,12 +3635,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
tool.state = down ? State_Sunken : State_Raised;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
- p->save();
+ QPainterStateSaver pss(p, down);
if (down)
p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
if (tb->subControls & SC_TitleBarShadeButton
@@ -3652,12 +3651,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
- p->save();
+ QPainterStateSaver pss(p, down);
if (down)
p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
if (tb->subControls & SC_TitleBarUnshadeButton
@@ -3670,12 +3668,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
- p->save();
+ QPainterStateSaver pss(p, down);
if (down)
p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
if (tb->subControls & SC_TitleBarContextHelpButton
&& tb->titleBarFlags & Qt::WindowContextHelpButtonHint) {
@@ -3686,12 +3683,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
- p->save();
+ QPainterStateSaver pss(p, down);
if (down)
p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
if (tb->subControls & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget);
@@ -3701,9 +3697,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget);
pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(QSize(iconSize, iconSize), p->device()->devicePixelRatio());
tool.rect = ir;
- p->save();
+ QPainterStateSaver pss(p);
proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
- p->restore();
}
}
}
@@ -3712,7 +3707,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
case CC_Dial:
if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
// OK, this is more a port of things over
- p->save();
+ QPainterStateSaver pss(p);
// avoid dithering
if (p->paintEngine()->hasFeature(QPaintEngine::Antialiasing))
@@ -3797,7 +3792,6 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
fropt.rect = br.adjusted(-2, -2, 2, 2);
proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget);
}
- p->restore();
}
break;
#endif // QT_CONFIG(dial)
@@ -3814,7 +3808,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
frame.lineWidth = groupBox->lineWidth;
frame.midLineWidth = groupBox->midLineWidth;
frame.rect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget);
- p->save();
+ QPainterStateSaver pss(p);
QRegion region(groupBox->rect);
if (!groupBox->text.isEmpty()) {
bool ltr = groupBox->direction == Qt::LeftToRight;
@@ -3829,7 +3823,6 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
}
p->setClipRegion(region);
proxy()->drawPrimitive(PE_FrameGroupBox, &frame, p, widget);
- p->restore();
}
// Draw title
@@ -3877,8 +3870,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) {
btnOpt.state |= State_Sunken;
btnOpt.state &= ~State_Raised;
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget);
} else {
btnOpt.state |= State_Raised;
btnOpt.state &= ~State_Sunken;
@@ -3894,8 +3887,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) {
btnOpt.state |= State_Sunken;
btnOpt.state &= ~State_Raised;
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget);
} else {
btnOpt.state |= State_Raised;
btnOpt.state &= ~State_Sunken;
@@ -3911,8 +3904,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) {
btnOpt.state |= State_Sunken;
btnOpt.state &= ~State_Raised;
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget);
} else {
btnOpt.state |= State_Raised;
btnOpt.state &= ~State_Sunken;
@@ -3928,7 +3921,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
break;
#endif // QT_CONFIG(mdiarea)
default:
- qWarning("QCommonStyle::drawComplexControl: Control %d not handled", cc);
+ qCWarning(lcCommonStyle, "QCommonStyle::drawComplexControl: Control %d not handled", cc);
}
}
@@ -4064,7 +4057,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
}
break;
default:
- qWarning("QCommonStyle::hitTestComplexControl: Case %d not handled", cc);
+ qCWarning(lcCommonStyle, "QCommonStyle::hitTestComplexControl: Case %d not handled", cc);
}
return sc;
}
@@ -4232,6 +4225,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
break;
case SC_SpinBoxFrame:
ret = spinbox->rect;
+ break;
default:
break;
}
@@ -4392,7 +4386,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
if (verticalAlignment & Qt::AlignVCenter)
topMargin = topHeight / 2;
else if (verticalAlignment & Qt::AlignTop)
- topMargin = topHeight;
+ topMargin = topHeight + proxy()->pixelMetric(PM_FocusFrameVMargin, groupBox, widget);
}
QRect frameRect = groupBox->rect;
@@ -4414,7 +4408,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
case SC_GroupBoxLabel: {
QFontMetrics fontMetrics = groupBox->fontMetrics;
int th = fontMetrics.height();
- int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width();
+ int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + u' ').width();
int marg = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 8;
ret = groupBox->rect.adjusted(marg, 0, -marg, 0);
@@ -4503,7 +4497,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
}
#endif // QT_CONFIG(mdiarea)
default:
- qWarning("QCommonStyle::subControlRect: Case %d not handled", cc);
+ qCWarning(lcCommonStyle, "QCommonStyle::subControlRect: Case %d not handled", cc);
}
#if !QT_CONFIG(slider) && !QT_CONFIG(spinbox) && !QT_CONFIG(toolbutton) && !QT_CONFIG(groupbox)
Q_UNUSED(widget);
@@ -4525,15 +4519,6 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_MenuBarHMargin:
ret = 0;
break;
- case PM_DialogButtonsSeparator:
- ret = int(QStyleHelper::dpiScaled(5, opt));
- break;
- case PM_DialogButtonsButtonWidth:
- ret = int(QStyleHelper::dpiScaled(70, opt));
- break;
- case PM_DialogButtonsButtonHeight:
- ret = int(QStyleHelper::dpiScaled(30, opt));
- break;
case PM_TitleBarHeight:
{
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
@@ -4831,6 +4816,9 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_LineEditIconSize:
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
+ case PM_LineEditIconMargin:
+ ret = proxy()->pixelMetric(PM_LineEditIconSize, opt, widget) / 4;
+ break;
case PM_LargeIconSize:
ret = int(QStyleHelper::dpiScaled(32, opt));
@@ -4889,125 +4877,141 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
/*!
\reimp
*/
-QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &csz, const QWidget *widget) const
+QSize QCommonStyle::sizeFromContents(ContentsType contentsType, const QStyleOption *opt,
+ const QSize &contentsSize, const QWidget *widget) const
{
Q_D(const QCommonStyle);
- QSize sz(csz);
- switch (ct) {
+ QSize size(contentsSize);
+ switch (contentsType) {
case CT_PushButton:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
- int w = csz.width(),
- h = csz.height(),
- bm = proxy()->pixelMetric(PM_ButtonMargin, btn, widget),
- fw = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2;
- w += bm + fw;
- h += bm + fw;
- if (btn->features & QStyleOptionButton::AutoDefaultButton){
- int dbw = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2;
- w += dbw;
- h += dbw;
- }
- sz = QSize(w, h);
+ if (const auto *buttonOpt = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+ int width = contentsSize.width();
+ int height = contentsSize.height();
+ const int buttonMargin = proxy()->pixelMetric(PM_ButtonMargin, buttonOpt, widget);
+ const int defaultFrameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, buttonOpt, widget) * 2;
+ width += buttonMargin + defaultFrameWidth;
+ height += buttonMargin + defaultFrameWidth;
+ if (buttonOpt->features.testFlag(QStyleOptionButton::AutoDefaultButton)) {
+ const int buttonIndicator = proxy()->pixelMetric(PM_ButtonDefaultIndicator,
+ buttonOpt,
+ widget) * 2;
+ width += buttonIndicator;
+ height += buttonIndicator;
+ }
+ size = QSize(width, height);
}
break;
case CT_RadioButton:
case CT_CheckBox:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
- bool isRadio = (ct == CT_RadioButton);
+ if (const auto *buttonOpt = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+ const bool isRadio = (contentsType == CT_RadioButton);
- int w = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth
- : PM_IndicatorWidth, btn, widget);
- int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
- : PM_IndicatorHeight, btn, widget);
+ const int width = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth
+ : PM_IndicatorWidth, buttonOpt, widget);
+ const int height = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
+ : PM_IndicatorHeight, buttonOpt, widget);
int margins = 0;
+
// we add 4 pixels for label margins
- if (!btn->icon.isNull() || !btn->text.isEmpty())
+ if (!buttonOpt->icon.isNull() || !buttonOpt->text.isEmpty()) {
margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing
: PM_CheckBoxLabelSpacing, opt, widget);
- sz += QSize(w + margins, 4);
- sz.setHeight(qMax(sz.height(), h));
+ }
+
+ size += QSize(width + margins, 4);
+ size.setHeight(qMax(size.height(), height));
}
break;
#if QT_CONFIG(menu)
case CT_MenuItem:
- if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
- bool checkable = mi->menuHasCheckableItems;
- int maxpmw = mi->maxIconWidth;
- int w = sz.width(), h = sz.height();
- if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
- w = 10;
- h = 2;
+ if (const auto *menuItemOpt = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
+ const bool checkable = menuItemOpt->menuHasCheckableItems;
+ const int maxpmw = menuItemOpt->maxIconWidth;
+ int width = size.width();
+ int height;
+ if (menuItemOpt->menuItemType == QStyleOptionMenuItem::Separator) {
+ width = 10;
+ height = 2;
} else {
- h = mi->fontMetrics.height() + 8;
- if (!mi->icon.isNull()) {
- int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt);
- h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
+ height = menuItemOpt->fontMetrics.height() + 8;
+ if (!menuItemOpt->icon.isNull()) {
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
+ height = qMax(height,
+ menuItemOpt->icon.actualSize(QSize(iconExtent,
+ iconExtent)).height() + 4);
}
}
- if (mi->text.contains(QLatin1Char('\t')))
- w += 12;
+ if (menuItemOpt->text.contains(u'\t'))
+ width += 12;
if (maxpmw > 0)
- w += maxpmw + 6;
+ width += maxpmw + 6;
if (checkable && maxpmw < 20)
- w += 20 - maxpmw;
+ width += 20 - maxpmw;
if (checkable || maxpmw > 0)
- w += 2;
- w += 12;
- sz = QSize(w, h);
+ width += 2;
+ width += 12;
+ size = QSize(width, height);
}
break;
#endif // QT_CONFIG(menu)
#if QT_CONFIG(toolbutton)
case CT_ToolButton:
- sz = QSize(sz.width() + 6, sz.height() + 5);
+ size = QSize(size.width() + 6, size.height() + 5);
break;
#endif // QT_CONFIG(toolbutton)
#if QT_CONFIG(combobox)
case CT_ComboBox:
- if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
- int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
- const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin, opt) + 1);
+ if (const auto *comboBoxOpt = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+ const int frameWidth = comboBoxOpt->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth,
+ opt,
+ widget) * 2 : 0;
+ const int textMargins = 2 * (proxy()->pixelMetric(PM_FocusFrameHMargin, opt, widget) + 1);
+
// QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins...
- int other = qMax(23, 2*textMargins + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget));
- sz = QSize(sz.width() + fw + other, sz.height() + fw);
+ const int other = qMax(23, 2 * textMargins
+ + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent,
+ opt, widget));
+
+ size = QSize(size.width() + frameWidth + other, size.height() + frameWidth);
}
break;
#endif // QT_CONFIG(combobox)
case CT_HeaderSection:
- if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
- bool nullIcon = hdr->icon.isNull();
- int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget);
- int iconSize = nullIcon ? 0 : proxy()->pixelMetric(QStyle::PM_SmallIconSize, hdr, widget);
- QSize txt = hdr->fontMetrics.size(0, hdr->text);
- sz.setHeight(margin + qMax(iconSize, txt.height()) + margin);
- sz.setWidth((nullIcon ? 0 : margin) + iconSize
- + (hdr->text.isNull() ? 0 : margin) + txt.width() + margin);
- if (hdr->sortIndicator != QStyleOptionHeader::None) {
- int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget);
- if (hdr->orientation == Qt::Horizontal)
- sz.rwidth() += sz.height() + margin;
+ if (const auto *headerOpt = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
+ const bool nullIcon = headerOpt->icon.isNull();
+ const int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, headerOpt, widget);
+ const int iconSize = nullIcon ? 0 : proxy()->pixelMetric(QStyle::PM_SmallIconSize,
+ headerOpt,
+ widget);
+ const QSize textSize = headerOpt->fontMetrics.size(0, headerOpt->text);
+ size.setHeight(margin + qMax(iconSize, textSize.height()) + margin);
+ size.setWidth((nullIcon ? 0 : margin) + iconSize
+ + (headerOpt->text.isNull() ? 0 : margin) + textSize.width() + margin);
+ if (headerOpt->sortIndicator != QStyleOptionHeader::None) {
+ const int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, headerOpt, widget);
+ if (headerOpt->orientation == Qt::Horizontal)
+ size.rwidth() += size.height() + margin;
else
- sz.rheight() += sz.width() + margin;
+ size.rheight() += size.width() + margin;
}
}
break;
case CT_TabWidget:
- sz += QSize(4, 4);
+ size += QSize(4, 4);
break;
case CT_LineEdit:
- if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt))
- sz += QSize(2*f->lineWidth, 2*f->lineWidth);
+ if (const auto *frameOpt = qstyleoption_cast<const QStyleOptionFrame *>(opt))
+ size += QSize(2 * frameOpt->lineWidth, 2 * frameOpt->lineWidth);
break;
#if QT_CONFIG(groupbox)
case CT_GroupBox:
- if (const QStyleOptionGroupBox *styleOpt = qstyleoption_cast<const QStyleOptionGroupBox *>(opt))
- sz += QSize(styleOpt->features.testFlag(QStyleOptionFrame::Flat) ? 0 : 16, 0);
+ if (const auto *groupBoxOpt = qstyleoption_cast<const QStyleOptionGroupBox *>(opt))
+ size += QSize(groupBoxOpt->features.testFlag(QStyleOptionFrame::Flat) ? 0 : 16, 0);
break;
#endif // QT_CONFIG(groupbox)
case CT_MdiControls:
- if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
+ if (const auto *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, styleOpt, widget);
int width = 1;
if (styleOpt->subControls & SC_MdiMinButton)
@@ -5016,34 +5020,36 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
width += buttonSize + 1;
if (styleOpt->subControls & SC_MdiCloseButton)
width += buttonSize + 1;
- sz = QSize(width, buttonSize);
+ size = QSize(width, buttonSize);
} else {
const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, opt, widget);
- sz = QSize(1 + 3 * (buttonSize + 1), buttonSize);
+ size = QSize(1 + 3 * (buttonSize + 1), buttonSize);
}
break;
#if QT_CONFIG(itemviews)
case CT_ItemViewItem:
- if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
+ if (const auto *viewItemOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
QRect decorationRect, displayRect, checkRect;
- d->viewItemLayout(vopt, &checkRect, &decorationRect, &displayRect, true);
- sz = (decorationRect|displayRect|checkRect).size();
- if (decorationRect.isValid() && sz.height() == decorationRect.height())
- sz.rheight() += 2; // Prevent icons from overlapping.
- }
+ d->viewItemLayout(viewItemOpt, &checkRect, &decorationRect, &displayRect, true);
+ size = (decorationRect|displayRect|checkRect).size();
+ if (decorationRect.isValid() && size.height() == decorationRect.height())
+ size.rheight() += 2; // Prevent icons from overlapping.
+ }
break;
#else
Q_UNUSED(d);
#endif // QT_CONFIG(itemviews)
#if QT_CONFIG(spinbox)
case CT_SpinBox:
- if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
+ if (const auto *spinBoxOpt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
// Add button + frame widths
const qreal dpi = QStyleHelper::dpi(opt);
- const bool hasButtons = (vopt->buttonSymbols != QAbstractSpinBox::NoButtons);
+ const bool hasButtons = (spinBoxOpt->buttonSymbols != QAbstractSpinBox::NoButtons);
const int buttonWidth = hasButtons ? qRound(QStyleHelper::dpiScaled(16, dpi)) : 0;
- const int fw = vopt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget) : 0;
- sz += QSize(buttonWidth + 2*fw, 2*fw);
+ const int frameWidth = spinBoxOpt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth,
+ spinBoxOpt, widget) : 0;
+
+ size += QSize(buttonWidth + 2 * frameWidth, 2 * frameWidth);
}
break;
#endif
@@ -5059,7 +5065,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
default:
break;
}
- return sz;
+ return size;
}
@@ -5174,9 +5180,12 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = 1;
break;
- case SH_UnderlineShortcut:
- ret = 1;
+ case SH_UnderlineShortcut: {
+ const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme();
+ ret = theme ? theme->themeHint(QPlatformTheme::UnderlineShortcut).toInt()
+ : QPlatformTheme::defaultThemeHint(QPlatformTheme::UnderlineShortcut).toInt();
break;
+ }
case SH_SpinBox_ClickAutoRepeatRate:
ret = 150;
@@ -5219,8 +5228,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
if (widget) {
if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
mask->region = widget->rect();
- const int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt);
- const int hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt);
+ const int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt, widget);
+ const int hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget);
mask->region -= QRect(widget->rect().adjusted(hmargin, vmargin, -hmargin, -vmargin));
}
}
@@ -5233,7 +5242,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = true;
if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
mask->region = opt->rect;
- const int margin = proxy()->pixelMetric(PM_DefaultFrameWidth, opt) * 2;
+ const int margin = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget) * 2;
mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin);
}
}
@@ -5414,8 +5423,54 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_TabBar_AllowWheelScrolling:
ret = true;
break;
- default:
- ret = 0;
+ case SH_SpinBox_SelectOnStep:
+ ret = true;
+ break;
+ case SH_EtchDisabledText:
+ case SH_DitherDisabledText:
+ case SH_ScrollBar_MiddleClickAbsolutePosition:
+ case SH_ScrollBar_ScrollWhenPointerLeavesControl:
+ case SH_Slider_SnapToValue:
+ case SH_Slider_SloppyKeyEvents:
+ case SH_ProgressDialog_CenterCancelButton:
+ case SH_PrintDialog_RightAlignButtons:
+ case SH_MainWindow_SpaceBelowMenuBar:
+ case SH_FontDialog_SelectAssociatedText:
+ case SH_Menu_AllowActiveAndDisabled:
+ case SH_Menu_SpaceActivatesItem:
+ case SH_ScrollView_FrameOnlyAroundContents:
+ case SH_ComboBox_ListMouseTracking:
+ case SH_Menu_MouseTracking:
+ case SH_MenuBar_MouseTracking:
+ case SH_ItemView_ChangeHighlightOnFocus:
+ case SH_Widget_ShareActivation:
+ case SH_Workspace_FillSpaceOnMaximize:
+ case SH_ComboBox_Popup:
+ case SH_TitleBar_NoBorder:
+ case SH_Slider_StopMouseOverSlider:
+ case SH_RichText_FullWidthSelection:
+ case SH_Menu_Scrollable:
+ case SH_TabBar_PreferNoArrows:
+ case SH_ScrollBar_LeftClickAbsolutePosition:
+ case SH_SpinBox_AnimateButton:
+ case SH_DrawMenuBarSeparator:
+ case SH_WindowFrame_Mask:
+ case SH_ToolTip_Mask:
+ case SH_Menu_Mask:
+ case SH_Menu_FlashTriggeredItem:
+ case SH_Menu_FadeOutOnHide:
+ case SH_ItemView_PaintAlternatingRowColorsForEmptyArea:
+ case SH_ComboBox_UseNativePopup:
+ case SH_Table_AlwaysDrawLeftTopGridLines:
+ ret = false;
+ break;
+ case SH_MenuBar_AltKeyNavigation:
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ ret = theme->themeHint(QPlatformTheme::MenuBarFocusOnAltPressRelease).toBool();
+ break;
+ case SH_CustomBase:
+ // Added to get compiler errors when a style hint is missing
+ ret = false;
break;
}
@@ -5437,653 +5492,313 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); }
#endif // QT_CONFIG(imageformat_xpm)
-#ifndef QT_NO_IMAGEFORMAT_PNG
-static inline QString clearText16IconPath()
-{
- return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png");
-}
-#endif // !QT_NO_IMAGEFORMAT_PNG
+#if QT_CONFIG(imageformat_png)
+static constexpr QLatin1StringView iconResourcePrefix() noexcept { return ":/qt-project.org/styles/commonstyle/images/"_L1; }
+static constexpr QLatin1StringView iconPngSuffix() noexcept { return ".png"_L1; }
-#if defined(Q_OS_WIN) || QT_CONFIG(imageformat_png)
-static QIcon clearTextIcon(bool rtl)
+template <typename T>
+static void addIconFiles(QStringView prefix, std::initializer_list<T> sizes, QIcon &icon,
+ QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off)
{
- const QString directionalThemeName = rtl
- ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
- if (QIcon::hasThemeIcon(directionalThemeName))
- return QIcon::fromTheme(directionalThemeName);
- const QString themeName = QStringLiteral("edit-clear");
- if (QIcon::hasThemeIcon(themeName))
- return QIcon::fromTheme(themeName);
-
- QIcon icon;
-#ifndef QT_NO_IMAGEFORMAT_PNG
- QPixmap clearText16(clearText16IconPath());
- Q_ASSERT(!clearText16.size().isEmpty());
- icon.addPixmap(clearText16);
- QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png"));
- Q_ASSERT(!clearText32.size().isEmpty());
- icon.addPixmap(clearText32);
- clearText32.setDevicePixelRatio(2); // The 32x32 pixmap can also be used for 16x16/devicePixelRatio=2
- icon.addPixmap(clearText32);
-#endif // !QT_NO_IMAGEFORMAT_PNG
- return icon;
+ const auto fullPrefix = iconResourcePrefix() + prefix;
+ for (int size : sizes)
+ icon.addFile(fullPrefix + QString::number(size) + iconPngSuffix(),
+ QSize(size, size), mode, state);
}
-#endif
+
+static constexpr auto dockTitleIconSizes = {10, 16, 20, 32, 48, 64};
+static constexpr auto titleBarSizes = {16, 32, 48};
+static constexpr auto toolBarExtHSizes = {8, 16, 32, 128};
+static constexpr auto toolBarExtVSizes = {5, 10, 20, 80};
+static constexpr auto pngIconSizes = {16, 32, 128};
+#endif // imageformat_png
/*! \reimp */
QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
const QWidget *widget) const
{
- const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QGuiApplication::isRightToLeft());
-#ifdef QT_NO_IMAGEFORMAT_PNG
- Q_UNUSED(widget);
- Q_UNUSED(sp);
-#else
- QPixmap pixmap;
+ Q_D(const QCommonStyle);
+ QIcon icon;
- if (QGuiApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
- switch (sp) {
- case SP_DialogYesButton:
- case SP_DialogOkButton:
- pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16);
- break;
- case SP_DialogApplyButton:
- pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16);
- break;
- case SP_DialogDiscardButton:
- pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16);
- break;
- case SP_DialogCloseButton:
- pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16);
- break;
- case SP_DirHomeIcon:
- pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16);
- break;
- case SP_MessageBoxInformation:
- pixmap = QIcon::fromTheme(QLatin1String("messagebox_info")).pixmap(16);
- break;
- case SP_MessageBoxWarning:
- pixmap = QIcon::fromTheme(QLatin1String("messagebox_warning")).pixmap(16);
- break;
- case SP_MessageBoxCritical:
- pixmap = QIcon::fromTheme(QLatin1String("messagebox_critical")).pixmap(16);
- break;
- case SP_MessageBoxQuestion:
- pixmap = QIcon::fromTheme(QLatin1String("help")).pixmap(16);
- break;
- case SP_DialogOpenButton:
- case SP_DirOpenIcon:
- pixmap = QIcon::fromTheme(QLatin1String("folder-open")).pixmap(16);
- break;
- case SP_FileIcon:
- pixmap = QIcon::fromTheme(QLatin1String("text-x-generic"),
- QIcon::fromTheme(QLatin1String("empty"))).pixmap(16);
- break;
- case SP_DirClosedIcon:
- case SP_DirIcon:
- pixmap = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
- break;
- case SP_DriveFDIcon:
- pixmap = QIcon::fromTheme(QLatin1String("media-floppy"),
- QIcon::fromTheme(QLatin1String("3floppy_unmount"))).pixmap(16);
- break;
- case SP_ComputerIcon:
- pixmap = QIcon::fromTheme(QLatin1String("computer"),
- QIcon::fromTheme(QLatin1String("system"))).pixmap(16);
- break;
- case SP_DesktopIcon:
- pixmap = QIcon::fromTheme(QLatin1String("user-desktop"),
- QIcon::fromTheme(QLatin1String("desktop"))).pixmap(16);
- break;
- case SP_TrashIcon:
- pixmap = QIcon::fromTheme(QLatin1String("user-trash"),
- QIcon::fromTheme(QLatin1String("trashcan_empty"))).pixmap(16);
- break;
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- pixmap = QIcon::fromTheme(QLatin1String("media-optical"),
- QIcon::fromTheme(QLatin1String("cdrom_unmount"))).pixmap(16);
- break;
- case SP_DriveHDIcon:
- pixmap = QIcon::fromTheme(QLatin1String("drive-harddisk"),
- QIcon::fromTheme(QLatin1String("hdd_unmount"))).pixmap(16);
- break;
- case SP_FileDialogToParent:
- pixmap = QIcon::fromTheme(QLatin1String("go-up"),
- QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
- break;
- case SP_FileDialogNewFolder:
- pixmap = QIcon::fromTheme(QLatin1String("folder_new")).pixmap(16);
- break;
- case SP_ArrowUp:
- pixmap = QIcon::fromTheme(QLatin1String("go-up"),
- QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
- break;
- case SP_ArrowDown:
- pixmap = QIcon::fromTheme(QLatin1String("go-down"),
- QIcon::fromTheme(QLatin1String("down"))).pixmap(16);
- break;
- case SP_ArrowRight:
- pixmap = QIcon::fromTheme(QLatin1String("go-next"),
- QIcon::fromTheme(QLatin1String("forward"))).pixmap(16);
- break;
- case SP_ArrowLeft:
- pixmap = QIcon::fromTheme(QLatin1String("go-previous"),
- QIcon::fromTheme(QLatin1String("back"))).pixmap(16);
- break;
- case SP_FileDialogDetailedView:
- pixmap = QIcon::fromTheme(QLatin1String("view_detailed")).pixmap(16);
- break;
- case SP_FileDialogListView:
- pixmap = QIcon::fromTheme(QLatin1String("view_icon")).pixmap(16);
- break;
- case SP_BrowserReload:
- pixmap = QIcon::fromTheme(QLatin1String("reload")).pixmap(16);
- break;
- case SP_BrowserStop:
- pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(16);
- break;
- case SP_MediaPlay:
- pixmap = QIcon::fromTheme(QLatin1String("media-playback-start")).pixmap(16);
- break;
- case SP_MediaPause:
- pixmap = QIcon::fromTheme(QLatin1String("media-playback-pause")).pixmap(16);
- break;
- case SP_MediaStop:
- pixmap = QIcon::fromTheme(QLatin1String("media-playback-stop")).pixmap(16);
- break;
- case SP_MediaSeekForward:
- pixmap = QIcon::fromTheme(QLatin1String("media-seek-forward")).pixmap(16);
- break;
- case SP_MediaSeekBackward:
- pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16);
- break;
- case SP_MediaSkipForward:
- pixmap = QIcon::fromTheme(QLatin1String("media-skip-forward")).pixmap(16);
- break;
- case SP_MediaSkipBackward:
- pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
- break;
- case SP_DialogResetButton:
- pixmap = QIcon::fromTheme(QLatin1String("edit-clear")).pixmap(24);
- break;
- case SP_DialogHelpButton:
- pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24);
- break;
- case SP_DialogNoButton:
- case SP_DialogCancelButton:
- pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"),
- QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24);
- break;
- case SP_DialogSaveButton:
- pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24);
- break;
- case SP_FileLinkIcon:
- pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
- if (!pixmap.isNull()) {
- QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16);
- if (fileIcon.isNull())
- fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16);
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.drawPixmap(0, 0, 16, 16, pixmap);
- return fileIcon;
- }
- }
- break;
- case SP_DirLinkIcon:
- pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
- if (!pixmap.isNull()) {
- QPixmap dirIcon = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
- if (!dirIcon.isNull()) {
- QPainter painter(&dirIcon);
- painter.drawPixmap(0, 0, 16, 16, pixmap);
- return dirIcon;
- }
- }
- break;
- case SP_LineEditClearButton:
- pixmap = clearTextIcon(rtl).pixmap(16);
- break;
- default:
- break;
- }
- }
+ icon = d->iconFromWindowsTheme(sp, option, widget);
+ if (!icon.isNull())
+ return icon.pixmap(QSize(16, 16), qt_getDevicePixelRatio(widget));
+
+ icon = d->iconFromApplicationTheme(sp, option, widget);
+ if (!icon.isNull())
+ return icon.pixmap(QSize(16, 16), qt_getDevicePixelRatio(widget));
+
+ icon = d->iconFromMacTheme(sp, option, widget);
+ if (!icon.isNull())
+ return icon.pixmap(QSize(16, 16), qt_getDevicePixelRatio(widget));
+
+ icon = d->iconFromResourceTheme(sp, option, widget);
+ if (!icon.isNull())
+ return icon.pixmap(QSize(16, 16), qt_getDevicePixelRatio(widget));
- if (!pixmap.isNull())
- return pixmap;
-#endif //QT_NO_IMAGEFORMAT_PNG
- switch (sp) {
#ifndef QT_NO_IMAGEFORMAT_XPM
- case SP_ToolBarHorizontalExtensionButton:
- if (rtl) {
- QImage im(tb_extension_arrow_h_xpm);
- im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false);
- return QPixmap::fromImage(im);
+ switch (sp) {
+ case QStyle::SP_ToolBarHorizontalExtensionButton:
+ if (d->rtl(option)) {
+ auto im = QImage(tb_extension_arrow_h_xpm).convertToFormat(QImage::Format_ARGB32).mirrored(true, false);
+ return QPixmap::fromImage(std::move(im));
}
return cachedPixmapFromXPM(tb_extension_arrow_h_xpm);
- case SP_ToolBarVerticalExtensionButton:
+ case QStyle::SP_ToolBarVerticalExtensionButton:
return cachedPixmapFromXPM(tb_extension_arrow_v_xpm);
- case SP_FileDialogStart:
+ case QStyle::SP_FileDialogStart:
return cachedPixmapFromXPM(filedialog_start_xpm);
- case SP_FileDialogEnd:
+ case QStyle::SP_FileDialogEnd:
return cachedPixmapFromXPM(filedialog_end_xpm);
-#endif
-#ifndef QT_NO_IMAGEFORMAT_PNG
- case SP_CommandLink:
- case SP_ArrowForward:
- if (rtl)
- return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
- return proxy()->standardPixmap(SP_ArrowRight, option, widget);
- case SP_ArrowBack:
- if (rtl)
- return proxy()->standardPixmap(SP_ArrowRight, option, widget);
- return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
- case SP_ArrowLeft:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-16.png"));
- case SP_ArrowRight:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-16.png"));
- case SP_ArrowUp:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-16.png"));
- case SP_ArrowDown:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-16.png"));
- case SP_FileDialogToParent:
- return proxy()->standardPixmap(SP_ArrowUp, option, widget);
- case SP_FileDialogNewFolder:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-16.png"));
- case SP_FileDialogDetailedView:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png"));
- case SP_FileDialogInfoView:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-16.png"));
- case SP_FileDialogContentsView:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-16.png"));
- case SP_FileDialogListView:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-16.png"));
- case SP_FileDialogBack:
- return proxy()->standardPixmap(SP_ArrowBack, option, widget);
- case SP_DriveHDIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/harddrive-16.png"));
- case SP_TrashIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-16.png"));
- case SP_DriveFDIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/floppy-16.png"));
- case SP_DriveNetIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/networkdrive-16.png"));
- case SP_DesktopIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/desktop-16.png"));
- case SP_ComputerIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/computer-16.png"));
- case SP_DriveCDIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-16.png"));
- case SP_DriveDVDIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-16.png"));
- case SP_DirHomeIcon:
- case SP_DirOpenIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-16.png"));
- case SP_DirIcon:
- case SP_DirClosedIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-16.png"));
- case SP_DirLinkIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirlink-16.png"));
- case SP_FileIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"));
- case SP_FileLinkIcon:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-16.png"));
- case SP_DialogOkButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png"));
- case SP_DialogCancelButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png"));
- case SP_DialogHelpButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png"));
- case SP_DialogOpenButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png"));
- case SP_DialogSaveButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png"));
- case SP_DialogCloseButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png"));
- case SP_DialogApplyButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png"));
- case SP_DialogResetButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png"));
- case SP_DialogDiscardButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png"));
- case SP_DialogYesButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png"));
- case SP_DialogNoButton:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png"));
- case SP_BrowserReload:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-24.png"));
- case SP_BrowserStop:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-24.png"));
- case SP_MediaPlay:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-32.png"));
- case SP_MediaPause:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-32.png"));
- case SP_MediaStop:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-32.png"));
- case SP_MediaSeekForward:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png"));
- case SP_MediaSeekBackward:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png"));
- case SP_MediaSkipForward:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png"));
- case SP_MediaSkipBackward:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png"));
- case SP_MediaVolume:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"));
- case SP_MediaVolumeMuted:
- return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"));
- case SP_LineEditClearButton:
- return QPixmap(clearText16IconPath());
-#endif // QT_NO_IMAGEFORMAT_PNG
- default:
- break;
- }
-
-#ifndef QT_NO_IMAGEFORMAT_XPM
- switch (sp) {
- case SP_TitleBarMenuButton:
+ case QStyle::SP_TitleBarMenuButton:
return titleBarMenuCachedPixmapFromXPM();
- case SP_TitleBarShadeButton:
+ case QStyle::SP_TitleBarShadeButton:
return cachedPixmapFromXPM(qt_shade_xpm);
- case SP_TitleBarUnshadeButton:
+ case QStyle::SP_TitleBarUnshadeButton:
return cachedPixmapFromXPM(qt_unshade_xpm);
- case SP_TitleBarNormalButton:
+ case QStyle::SP_TitleBarNormalButton:
return cachedPixmapFromXPM(qt_normalizeup_xpm);
- case SP_TitleBarMinButton:
+ case QStyle::SP_TitleBarMinButton:
return cachedPixmapFromXPM(qt_minimize_xpm);
- case SP_TitleBarMaxButton:
+ case QStyle::SP_TitleBarMaxButton:
return cachedPixmapFromXPM(qt_maximize_xpm);
- case SP_TitleBarCloseButton:
+ case QStyle::SP_TitleBarCloseButton:
return cachedPixmapFromXPM(qt_close_xpm);
- case SP_TitleBarContextHelpButton:
+ case QStyle::SP_TitleBarContextHelpButton:
return cachedPixmapFromXPM(qt_help_xpm);
- case SP_DockWidgetCloseButton:
+ case QStyle::SP_DockWidgetCloseButton:
return cachedPixmapFromXPM(dock_widget_close_xpm);
- case SP_MessageBoxInformation:
+ case QStyle::SP_MessageBoxInformation:
return cachedPixmapFromXPM(information_xpm);
- case SP_MessageBoxWarning:
+ case QStyle::SP_MessageBoxWarning:
return cachedPixmapFromXPM(warning_xpm);
- case SP_MessageBoxCritical:
+ case QStyle::SP_MessageBoxCritical:
return cachedPixmapFromXPM(critical_xpm);
- case SP_MessageBoxQuestion:
+ case QStyle::SP_MessageBoxQuestion:
return cachedPixmapFromXPM(question_xpm);
default:
break;
}
#endif //QT_NO_IMAGEFORMAT_XPM
-#if !QT_CONFIG(imageformat_png) && !QT_CONFIG(imageformat_xpm) && !QT_CONFIG(imageformat_png)
- Q_UNUSED(rtl);
-#endif
-
return QPixmap();
}
-#if QT_CONFIG(imageformat_png)
-static inline QString iconResourcePrefix() { return QStringLiteral(":/qt-project.org/styles/commonstyle/images/"); }
-static inline QString iconPngSuffix() { return QStringLiteral(".png"); }
-
-static void addIconFiles(const QString &prefix, const int sizes[], size_t count, QIcon &icon)
-{
- for (size_t i = 0; i < count; ++i)
- icon.addFile(prefix + QString::number(sizes[i]) + iconPngSuffix());
-}
-
-static const int dockTitleIconSizes[] = {10, 16, 20, 32, 48, 64};
-static const int titleBarSizes[] = {16, 32, 48};
-static const int toolBarExtHSizes[] = {8, 16, 32};
-static const int toolBarExtVSizes[] = {5, 10, 20};
-#endif // imageformat_png
-
-/*!
- \internal
-*/
-QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
- const QWidget *widget) const
+QIcon QCommonStylePrivate::iconFromWindowsTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const
{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
QIcon icon;
- const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QGuiApplication::isRightToLeft());
-
#ifdef Q_OS_WIN
switch (standardIcon) {
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- case SP_DriveNetIcon:
- case SP_DriveHDIcon:
- case SP_DriveFDIcon:
- case SP_FileIcon:
- case SP_FileLinkIcon:
- case SP_DesktopIcon:
- case SP_ComputerIcon:
- case SP_VistaShield:
- case SP_MessageBoxInformation:
- case SP_MessageBoxWarning:
- case SP_MessageBoxCritical:
- case SP_MessageBoxQuestion:
+ case QStyle::SP_DriveCDIcon:
+ case QStyle::SP_DriveDVDIcon:
+ case QStyle::SP_DriveNetIcon:
+ case QStyle::SP_DriveHDIcon:
+ case QStyle::SP_DriveFDIcon:
+ case QStyle::SP_FileIcon:
+ case QStyle::SP_FileLinkIcon:
+ case QStyle::SP_DesktopIcon:
+ case QStyle::SP_ComputerIcon:
+ case QStyle::SP_VistaShield:
+ case QStyle::SP_MessageBoxInformation:
+ case QStyle::SP_MessageBoxWarning:
+ case QStyle::SP_MessageBoxCritical:
+ case QStyle::SP_MessageBoxQuestion:
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon);
- for (int size = 16 ; size <= 32 ; size += 16) {
- QPixmap pixmap = theme->standardPixmap(sp, QSizeF(size, size));
+ const auto dpr = qt_getDevicePixelRatio(widget);
+ const QList<QSize> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<QSize>>();
+ for (const QSize &size : sizes) {
+ QPixmap pixmap = theme->standardPixmap(sp, size * dpr);
+ pixmap.setDevicePixelRatio(dpr);
icon.addPixmap(pixmap, QIcon::Normal);
}
}
break;
- case SP_DirIcon:
- case SP_DirLinkIcon:
+ case QStyle::SP_DirIcon:
+ case QStyle::SP_DirLinkIcon:
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QPlatformTheme::StandardPixmap spOff = static_cast<QPlatformTheme::StandardPixmap>(standardIcon);
- QPlatformTheme::StandardPixmap spOn = standardIcon == SP_DirIcon ? QPlatformTheme::DirOpenIcon :
- QPlatformTheme::DirLinkOpenIcon;
- for (int size = 16 ; size <= 32 ; size += 16) {
- QSizeF pixSize(size, size);
+ QPlatformTheme::StandardPixmap spOn = standardIcon == QStyle::SP_DirIcon ? QPlatformTheme::DirOpenIcon
+ : QPlatformTheme::DirLinkOpenIcon;
+ const auto dpr = qt_getDevicePixelRatio(widget);
+ const QList<QSize> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<QSize>>();
+ for (const QSize &size : sizes) {
+ const QSizeF pixSize = size * dpr;
QPixmap pixmap = theme->standardPixmap(spOff, pixSize);
+ pixmap.setDevicePixelRatio(dpr);
icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);
pixmap = theme->standardPixmap(spOn, pixSize);
+ pixmap.setDevicePixelRatio(dpr);
icon.addPixmap(pixmap, QIcon::Normal, QIcon::On);
}
}
break;
- case SP_LineEditClearButton:
- icon = clearTextIcon(rtl);
- break;
default:
break;
}
- if (!icon.isNull())
- return icon;
-
+#else
+ Q_UNUSED(standardIcon)
#endif
+ return icon;
+}
+QIcon QCommonStylePrivate::iconFromApplicationTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
if (QGuiApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
- case SP_DirHomeIcon:
- icon = QIcon::fromTheme(QLatin1String("user-home"));
- break;
- case SP_MessageBoxInformation:
- icon = QIcon::fromTheme(QLatin1String("dialog-information"));
- break;
- case SP_MessageBoxWarning:
- icon = QIcon::fromTheme(QLatin1String("dialog-warning"));
- break;
- case SP_MessageBoxCritical:
- icon = QIcon::fromTheme(QLatin1String("dialog-error"));
- break;
- case SP_MessageBoxQuestion:
- icon = QIcon::fromTheme(QLatin1String("dialog-question"));
- break;
- case SP_DialogOpenButton:
- case SP_DirOpenIcon:
- icon = QIcon::fromTheme(QLatin1String("folder-open"));
- break;
- case SP_DialogSaveButton:
- icon = QIcon::fromTheme(QLatin1String("document-save"));
- break;
- case SP_DialogApplyButton:
- icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply"));
- break;
- case SP_DialogYesButton:
- case SP_DialogOkButton:
- icon = QIcon::fromTheme(QLatin1String("dialog-ok"));
- break;
- case SP_DialogDiscardButton:
- icon = QIcon::fromTheme(QLatin1String("edit-delete"));
- break;
- case SP_DialogResetButton:
- icon = QIcon::fromTheme(QLatin1String("edit-clear"));
- break;
- case SP_DialogHelpButton:
- icon = QIcon::fromTheme(QLatin1String("help-contents"));
- break;
- case SP_FileIcon:
- icon = QIcon::fromTheme(QLatin1String("text-x-generic"));
- break;
- case SP_DirClosedIcon:
- case SP_DirIcon:
- icon = QIcon::fromTheme(QLatin1String("folder"));
- break;
- case SP_DriveFDIcon:
- icon = QIcon::fromTheme(QLatin1String("floppy_unmount"));
- break;
- case SP_ComputerIcon:
- icon = QIcon::fromTheme(QLatin1String("computer"),
- QIcon::fromTheme(QLatin1String("system")));
- break;
- case SP_DesktopIcon:
- icon = QIcon::fromTheme(QLatin1String("user-desktop"));
- break;
- case SP_TrashIcon:
- icon = QIcon::fromTheme(QLatin1String("user-trash"));
- break;
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- icon = QIcon::fromTheme(QLatin1String("media-optical"));
- break;
- case SP_DriveHDIcon:
- icon = QIcon::fromTheme(QLatin1String("drive-harddisk"));
- break;
- case SP_FileDialogToParent:
- icon = QIcon::fromTheme(QLatin1String("go-up"));
- break;
- case SP_FileDialogNewFolder:
- icon = QIcon::fromTheme(QLatin1String("folder-new"));
- break;
- case SP_ArrowUp:
- icon = QIcon::fromTheme(QLatin1String("go-up"));
- break;
- case SP_ArrowDown:
- icon = QIcon::fromTheme(QLatin1String("go-down"));
- break;
- case SP_ArrowRight:
- icon = QIcon::fromTheme(QLatin1String("go-next"));
- break;
- case SP_ArrowLeft:
- icon = QIcon::fromTheme(QLatin1String("go-previous"));
- break;
- case SP_DialogNoButton:
- case SP_DialogCancelButton:
- icon = QIcon::fromTheme(QLatin1String("dialog-cancel"),
- QIcon::fromTheme(QLatin1String("process-stop")));
- break;
- case SP_DialogCloseButton:
- icon = QIcon::fromTheme(QLatin1String("window-close"));
- break;
- case SP_FileDialogDetailedView:
- icon = QIcon::fromTheme(QLatin1String("view-list-details"));
- break;
- case SP_FileDialogListView:
- icon = QIcon::fromTheme(QLatin1String("view-list-icons"));
- break;
- case SP_BrowserReload:
- icon = QIcon::fromTheme(QLatin1String("view-refresh"));
- break;
- case SP_BrowserStop:
- icon = QIcon::fromTheme(QLatin1String("process-stop"));
- break;
- case SP_MediaPlay:
- icon = QIcon::fromTheme(QLatin1String("media-playback-start"));
- break;
- case SP_MediaPause:
- icon = QIcon::fromTheme(QLatin1String("media-playback-pause"));
- break;
- case SP_MediaStop:
- icon = QIcon::fromTheme(QLatin1String("media-playback-stop"));
- break;
- case SP_MediaSeekForward:
- icon = QIcon::fromTheme(QLatin1String("media-seek-forward"));
- break;
- case SP_MediaSeekBackward:
- icon = QIcon::fromTheme(QLatin1String("media-seek-backward"));
- break;
- case SP_MediaSkipForward:
- icon = QIcon::fromTheme(QLatin1String("media-skip-forward"));
- break;
- case SP_MediaSkipBackward:
- icon = QIcon::fromTheme(QLatin1String("media-skip-backward"));
- break;
- case SP_MediaVolume:
- icon = QIcon::fromTheme(QLatin1String("audio-volume-medium"));
- break;
- case SP_MediaVolumeMuted:
- icon = QIcon::fromTheme(QLatin1String("audio-volume-muted"));
- break;
- case SP_ArrowForward:
- if (rtl)
- return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget);
- return QCommonStyle::standardIcon(SP_ArrowRight, option, widget);
- case SP_ArrowBack:
- if (rtl)
- return QCommonStyle::standardIcon(SP_ArrowRight, option, widget);
- return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget);
- case SP_FileLinkIcon:
- {
- QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
- if (!linkIcon.isNull()) {
- QIcon baseIcon = QCommonStyle::standardIcon(SP_FileIcon, option, widget);
- const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
- for (int i = 0 ; i < sizes.size() ; ++i) {
- int size = sizes[i].width();
- QPixmap basePixmap = baseIcon.pixmap(QSize(size, size), qt_getDevicePixelRatio(widget));
- QPixmap linkPixmap = linkIcon.pixmap(QSize(size / 2, size / 2), qt_getDevicePixelRatio(widget));
+ case QStyle::SP_DirHomeIcon:
+ return QIcon::fromTheme("user-home"_L1);
+ case QStyle::SP_MessageBoxInformation:
+ return QIcon::fromTheme("dialog-information"_L1);
+ case QStyle::SP_MessageBoxWarning:
+ return QIcon::fromTheme("dialog-warning"_L1);
+ case QStyle::SP_MessageBoxCritical:
+ return QIcon::fromTheme("dialog-error"_L1);
+ case QStyle::SP_MessageBoxQuestion:
+ return QIcon::fromTheme("dialog-question"_L1);
+ case QStyle::SP_DialogOpenButton:
+ case QStyle::SP_DirOpenIcon:
+ return QIcon::fromTheme("folder-open"_L1);
+ case QStyle::SP_DialogSaveButton:
+ return QIcon::fromTheme("document-save"_L1);
+ case QStyle::SP_DialogApplyButton:
+ return QIcon::fromTheme("dialog-ok-apply"_L1);
+ case QStyle::SP_DialogYesButton:
+ case QStyle::SP_DialogOkButton:
+ return QIcon::fromTheme("dialog-ok"_L1);
+ case QStyle::SP_DialogDiscardButton:
+ return QIcon::fromTheme("edit-delete"_L1);
+ case QStyle::SP_DialogResetButton:
+ return QIcon::fromTheme("edit-clear"_L1);
+ case QStyle::SP_DialogHelpButton:
+ return QIcon::fromTheme("help-contents"_L1);
+ case QStyle::SP_FileIcon:
+ return QIcon::fromTheme("text-x-generic"_L1);
+ case QStyle::SP_DirClosedIcon:
+ case QStyle::SP_DirIcon:
+ return QIcon::fromTheme("folder"_L1);
+ case QStyle::SP_DriveFDIcon:
+ return QIcon::fromTheme("floppy_unmount"_L1);
+ case QStyle::SP_ComputerIcon:
+ return QIcon::fromTheme("computer"_L1, QIcon::fromTheme("system"_L1));
+ case QStyle::SP_DesktopIcon:
+ return QIcon::fromTheme("user-desktop"_L1);
+ case QStyle::SP_TrashIcon:
+ return QIcon::fromTheme("user-trash"_L1);
+ case QStyle::SP_DriveCDIcon:
+ case QStyle::SP_DriveDVDIcon:
+ return QIcon::fromTheme("media-optical"_L1);
+ case QStyle::SP_DriveHDIcon:
+ return QIcon::fromTheme("drive-harddisk"_L1);
+ case QStyle::SP_FileDialogToParent:
+ return QIcon::fromTheme("go-up"_L1);
+ case QStyle::SP_FileDialogNewFolder:
+ return QIcon::fromTheme("folder-new"_L1);
+ case QStyle::SP_ArrowUp:
+ return QIcon::fromTheme("go-up"_L1);
+ case QStyle::SP_ArrowDown:
+ return QIcon::fromTheme("go-down"_L1);
+ case QStyle::SP_ArrowRight:
+ return QIcon::fromTheme("go-next"_L1);
+ case QStyle::SP_ArrowLeft:
+ return QIcon::fromTheme("go-previous"_L1);
+ case QStyle::SP_DialogNoButton:
+ case QStyle::SP_DialogCancelButton:
+ return QIcon::fromTheme("dialog-cancel"_L1, QIcon::fromTheme("process-stop"_L1));
+ case QStyle::SP_DialogCloseButton:
+ return QIcon::fromTheme("window-close"_L1);
+ case QStyle::SP_FileDialogDetailedView:
+ return QIcon::fromTheme("view-list-details"_L1);
+ case QStyle::SP_FileDialogListView:
+ return QIcon::fromTheme("view-list-icons"_L1);
+ case QStyle::SP_BrowserReload:
+ return QIcon::fromTheme("view-refresh"_L1);
+ case QStyle::SP_BrowserStop:
+ return QIcon::fromTheme("process-stop"_L1);
+ case QStyle::SP_MediaPlay:
+ return QIcon::fromTheme("media-playback-start"_L1);
+ case QStyle::SP_MediaPause:
+ return QIcon::fromTheme("media-playback-pause"_L1);
+ case QStyle::SP_MediaStop:
+ return QIcon::fromTheme("media-playback-stop"_L1);
+ case QStyle::SP_MediaSeekForward:
+ return QIcon::fromTheme("media-seek-forward"_L1);
+ case QStyle::SP_MediaSeekBackward:
+ return QIcon::fromTheme("media-seek-backward"_L1);
+ case QStyle::SP_MediaSkipForward:
+ return QIcon::fromTheme("media-skip-forward"_L1);
+ case QStyle::SP_MediaSkipBackward:
+ return QIcon::fromTheme("media-skip-backward"_L1);
+ case QStyle::SP_MediaVolume:
+ return QIcon::fromTheme("audio-volume-medium"_L1);
+ case QStyle::SP_MediaVolumeMuted:
+ return QIcon::fromTheme("audio-volume-muted"_L1);
+ case QStyle::SP_ArrowForward:
+ return iconFromApplicationTheme(rtl(option) ? QStyle::SP_ArrowLeft
+ : QStyle::SP_ArrowRight,
+ option, widget);
+ case QStyle::SP_ArrowBack:
+ return iconFromApplicationTheme(rtl(option) ? QStyle::SP_ArrowRight
+ : QStyle::SP_ArrowLeft,
+ option, widget);
+ case QStyle::SP_DirLinkIcon:
+ case QStyle::SP_FileLinkIcon: {
+ const auto si = (standardIcon == QStyle::SP_DirLinkIcon)
+ ? QStyle::SP_DirIcon : QStyle::SP_FileIcon;
+ QIcon icon;
+ const QIcon linkIcon = QIcon::fromTheme("emblem-symbolic-link"_L1);
+ const QIcon baseIcon = iconFromApplicationTheme(si, option, widget);
+ if (!linkIcon.isNull() || !baseIcon.isNull()) {
+ const auto sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
+ const auto dpr = qt_getDevicePixelRatio(widget);
+ for (const auto size : sizes) {
+ QPixmap basePixmap = baseIcon.pixmap(size, dpr);
+ QPixmap linkPixmap = linkIcon.pixmap(size / 2, dpr);
QPainter painter(&basePixmap);
- painter.drawPixmap(size/2, size/2, linkPixmap);
+ const auto w = size.width() / 2;
+ painter.drawPixmap(w, w, linkPixmap);
icon.addPixmap(basePixmap);
}
}
+ return icon;
}
break;
- case SP_DirLinkIcon:
- {
- QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
- if (!linkIcon.isNull()) {
- QIcon baseIcon = QCommonStyle::standardIcon(SP_DirIcon, option, widget);
- const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
- for (int i = 0 ; i < sizes.size() ; ++i) {
- int size = sizes[i].width();
- QPixmap basePixmap = baseIcon.pixmap(QSize(size, size), qt_getDevicePixelRatio(widget));
- QPixmap linkPixmap = linkIcon.pixmap(QSize(size / 2, size / 2), qt_getDevicePixelRatio(widget));
- QPainter painter(&basePixmap);
- painter.drawPixmap(size/2, size/2, linkPixmap);
- icon.addPixmap(basePixmap);
- }
- }
+ case QStyle::SP_LineEditClearButton: {
+ const QString directionalThemeName = rtl(option)
+ ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
+ if (QIcon::hasThemeIcon(directionalThemeName))
+ return QIcon::fromTheme(directionalThemeName);
+ const QString themeName = QStringLiteral("edit-clear");
+ if (QIcon::hasThemeIcon(themeName))
+ return QIcon::fromTheme(themeName);
+ break;
}
- break;
default:
break;
}
} // if (QGuiApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty())
- if (!icon.isNull())
- return icon;
+ return {};
+}
-#if defined(Q_OS_MAC)
+QIcon QCommonStylePrivate::iconFromMacTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+#ifdef Q_OS_DARWIN
+ Q_Q(const QCommonStyle);
if (QGuiApplication::desktopSettingsAware()) {
switch (standardIcon) {
- case SP_DirIcon: {
+ case QStyle::SP_DirIcon: {
// A rather special case
- QIcon closeIcon = QCommonStyle::standardIcon(SP_DirClosedIcon, option, widget);
- QIcon openIcon = QCommonStyle::standardIcon(SP_DirOpenIcon, option, widget);
+ QIcon closeIcon = q->standardIcon(QStyle::SP_DirClosedIcon, option, widget);
+ QIcon openIcon = q->standardIcon(QStyle::SP_DirOpenIcon, option, widget);
closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
@@ -6091,43 +5806,46 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
return closeIcon;
}
- case SP_TitleBarNormalButton:
- case SP_TitleBarCloseButton: {
+ case QStyle::SP_TitleBarNormalButton:
+ case QStyle::SP_TitleBarCloseButton: {
QIcon titleBarIcon;
- if (standardIcon == SP_TitleBarCloseButton) {
- titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/closedock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
- } else {
- titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/dockdock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ constexpr auto imagesPrefix = ":/qt-project.org/styles/macstyle/images/"_L1;
+ const auto namePrefix = standardIcon == QStyle::SP_TitleBarCloseButton
+ ? "closedock-"_L1
+ : "dockdock-"_L1;
+ for (const auto size : dockTitleIconSizes) {
+ titleBarIcon.addFile(imagesPrefix + namePrefix + "macstyle-"_L1 + QString::number(size)
+ + iconPngSuffix(), QSize(size, size), QIcon::Normal, QIcon::Off);
+ titleBarIcon.addFile(imagesPrefix + namePrefix + "down-macstyle-"_L1 + QString::number(size)
+ + iconPngSuffix(), QSize(size, size), QIcon::Normal, QIcon::On);
}
return titleBarIcon;
}
- case SP_MessageBoxQuestion:
- case SP_MessageBoxInformation:
- case SP_MessageBoxWarning:
- case SP_MessageBoxCritical:
- case SP_DesktopIcon:
- case SP_TrashIcon:
- case SP_ComputerIcon:
- case SP_DriveFDIcon:
- case SP_DriveHDIcon:
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- case SP_DriveNetIcon:
- case SP_DirOpenIcon:
- case SP_DirClosedIcon:
- case SP_DirLinkIcon:
- case SP_FileLinkIcon:
- case SP_FileIcon:
+ case QStyle::SP_MessageBoxQuestion:
+ case QStyle::SP_MessageBoxInformation:
+ case QStyle::SP_MessageBoxWarning:
+ case QStyle::SP_MessageBoxCritical:
+ case QStyle::SP_DesktopIcon:
+ case QStyle::SP_TrashIcon:
+ case QStyle::SP_ComputerIcon:
+ case QStyle::SP_DriveFDIcon:
+ case QStyle::SP_DriveHDIcon:
+ case QStyle::SP_DriveCDIcon:
+ case QStyle::SP_DriveDVDIcon:
+ case QStyle::SP_DriveNetIcon:
+ case QStyle::SP_DirOpenIcon:
+ case QStyle::SP_DirClosedIcon:
+ case QStyle::SP_DirLinkIcon:
+ case QStyle::SP_FileLinkIcon:
+ case QStyle::SP_FileIcon:
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon);
QIcon retIcon;
const QList<QSize> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<QSize> >();
for (const QSize &size : sizes) {
QPixmap mainIcon;
- const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size.width());
+ const QString cacheKey = "qt_mac_constructQIconFromIconRef"_L1 + QString::number(standardIcon) + QString::number(size.width());
if (standardIcon >= QStyle::SP_CustomBase) {
mainIcon = theme->standardPixmap(sp, QSizeF(size));
} else if (QPixmapCache::find(cacheKey, &mainIcon) == false) {
@@ -6137,263 +5855,288 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
retIcon.addPixmap(mainIcon);
}
- if (!retIcon.isNull())
- return retIcon;
+ return retIcon;
}
default:
break;
}
} // if (QGuiApplication::desktopSettingsAware())
-#endif // Q_OS_MAC
+#else // Q_OS_DARWIN
+ Q_UNUSED(standardIcon);
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+#endif // Q_OS_DARWIN
+ return {};
+}
- switch (standardIcon) {
+QIcon QCommonStylePrivate::iconFromResourceTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ Q_Q(const QCommonStyle);
+ QIcon icon;
#ifndef QT_NO_IMAGEFORMAT_PNG
- case SP_TitleBarMinButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("titlebar-min-"),
- titleBarSizes, sizeof(titleBarSizes)/sizeof(titleBarSizes[0]), icon);
- break;
- case SP_TitleBarMaxButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("titlebar-max-"),
- titleBarSizes, sizeof(titleBarSizes)/sizeof(titleBarSizes[0]), icon);
- break;
- case SP_TitleBarShadeButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("titlebar-shade-"),
- titleBarSizes, sizeof(titleBarSizes)/sizeof(titleBarSizes[0]), icon);
-
- break;
- case SP_TitleBarUnshadeButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("titlebar-unshade-"),
- titleBarSizes, sizeof(titleBarSizes)/sizeof(titleBarSizes[0]), icon);
- break;
- case SP_TitleBarContextHelpButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("titlebar-contexthelp-"),
- titleBarSizes, sizeof(titleBarSizes)/sizeof(titleBarSizes[0]), icon);
- break;
- case SP_FileDialogNewFolder:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-128.png"), QSize(128, 128));
- break;
- case SP_FileDialogBack:
- return QCommonStyle::standardIcon(SP_ArrowBack, option, widget);
- case SP_FileDialogToParent:
- return QCommonStyle::standardIcon(SP_ArrowUp, option, widget);
- case SP_FileDialogDetailedView:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-128.png"), QSize(128, 128));
- break;
- case SP_FileDialogInfoView:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-128.png"), QSize(128, 128));
- break;
- case SP_FileDialogContentsView:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-128.png"), QSize(128, 128));
- break;
- case SP_FileDialogListView:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-128.png"), QSize(128, 128));
- break;
- case SP_DialogOkButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-128.png"), QSize(128, 128));
- break;
- case SP_DialogCancelButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-128.png"), QSize(128, 128));
- break;
- case SP_DialogHelpButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-128.png"), QSize(128, 128));
- break;
- case SP_DialogOpenButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-128.png"), QSize(128, 128));
- break;
- case SP_DialogSaveButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-128.png"), QSize(128, 128));
- break;
- case SP_DialogCloseButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-128.png"), QSize(128, 128));
- break;
- case SP_DialogApplyButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-128.png"), QSize(128, 128));
- break;
- case SP_DialogResetButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-128.png"), QSize(128, 128));
- break;
- case SP_DialogDiscardButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-128.png"), QSize(128, 128));
- break;
- case SP_DialogYesButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-128.png"), QSize(128, 128));
- break;
- case SP_DialogNoButton:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-128.png"), QSize(128, 128));
- break;
- case SP_ArrowForward:
- if (rtl)
- return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget);
- return QCommonStyle::standardIcon(SP_ArrowRight, option, widget);
- case SP_ArrowBack:
- if (rtl)
- return QCommonStyle::standardIcon(SP_ArrowRight, option, widget);
- return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget);
- case SP_ArrowLeft:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-128.png"), QSize(128, 128));
- break;
- case SP_ArrowRight:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-128.png"), QSize(128, 128));
- break;
- case SP_ArrowUp:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-128.png"), QSize(128, 128));
- break;
- case SP_ArrowDown:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-128.png"), QSize(128, 128));
- break;
- case SP_DirHomeIcon:
- case SP_DirIcon:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-16.png"),
- QSize(), QIcon::Normal, QIcon::Off);
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-16.png"),
- QSize(), QIcon::Normal, QIcon::On);
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-32.png"),
- QSize(32, 32), QIcon::Normal, QIcon::Off);
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-32.png"),
- QSize(32, 32), QIcon::Normal, QIcon::On);
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-128.png"),
- QSize(128, 128), QIcon::Normal, QIcon::Off);
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-128.png"),
- QSize(128, 128), QIcon::Normal, QIcon::On);
- break;
- case SP_DriveCDIcon:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-128.png"), QSize(128, 128));
- break;
- case SP_DriveDVDIcon:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-128.png"), QSize(128, 128));
- break;
- case SP_FileIcon:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-128.png"), QSize(128, 128));
- break;
- case SP_FileLinkIcon:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-128.png"), QSize(128, 128));
- break;
- case SP_TrashIcon:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-32.png"), QSize(32, 32));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-128.png"), QSize(128, 128));
- break;
- case SP_BrowserReload:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-24.png"), QSize(24, 24));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-32.png"), QSize(32, 32));
- break;
- case SP_BrowserStop:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-24.png"), QSize(24, 24));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-32.png"), QSize(32, 32));
- break;
- case SP_MediaPlay:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-32.png"), QSize(32, 32));
- break;
- case SP_MediaPause:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-32.png"), QSize(32, 32));
- break;
- case SP_MediaStop:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-32.png"), QSize(32, 32));
- break;
- case SP_MediaSeekForward:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png"), QSize(32, 32));
- break;
- case SP_MediaSeekBackward:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png"), QSize(32, 32));
- break;
- case SP_MediaSkipForward:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png"), QSize(32, 32));
- break;
- case SP_MediaSkipBackward:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-16.png"), QSize(16, 16));
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png"), QSize(32, 32));
- break;
- case SP_MediaVolume:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"), QSize(16, 16));
- break;
- case SP_MediaVolumeMuted:
- icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16));
- break;
- case SP_TitleBarCloseButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("closedock-"),
- dockTitleIconSizes, sizeof(dockTitleIconSizes)/sizeof(dockTitleIconSizes[0]), icon);
- break;
- case SP_TitleBarMenuButton:
+ switch (standardIcon) {
+ case QStyle::SP_MessageBoxInformation:
+ addIconFiles(u"information-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MessageBoxWarning:
+ addIconFiles(u"warning-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MessageBoxCritical:
+ addIconFiles(u"critical-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MessageBoxQuestion:
+ addIconFiles(u"question-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileDialogStart:
+ addIconFiles(u"filedialog_start-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileDialogEnd:
+ addIconFiles(u"filedialog_end-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_TitleBarMinButton:
+ addIconFiles(u"titlebar-min-", titleBarSizes, icon);
+ break;
+ case QStyle::SP_TitleBarMaxButton:
+ addIconFiles(u"titlebar-max-", titleBarSizes, icon);
+ break;
+ case QStyle::SP_TitleBarShadeButton:
+ addIconFiles(u"titlebar-shade-", titleBarSizes, icon);
+ break;
+ case QStyle::SP_TitleBarUnshadeButton:
+ addIconFiles(u"titlebar-unshade-", titleBarSizes, icon);
+ break;
+ case QStyle::SP_TitleBarContextHelpButton:
+ addIconFiles(u"titlebar-contexthelp-", titleBarSizes, icon);
+ break;
+ case QStyle::SP_FileDialogNewFolder:
+ addIconFiles(u"newdirectory-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileDialogBack:
+ return q->proxy()->standardIcon(QStyle::SP_ArrowBack, option, widget);
+ case QStyle::SP_FileDialogToParent:
+ return q->proxy()->standardIcon(QStyle::SP_ArrowUp, option, widget);
+ case QStyle::SP_FileDialogDetailedView:
+ addIconFiles(u"viewdetailed-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileDialogInfoView:
+ addIconFiles(u"fileinfo-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileDialogContentsView:
+ addIconFiles(u"filecontents-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileDialogListView:
+ addIconFiles(u"viewlist-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogOkButton:
+ addIconFiles(u"standardbutton-ok-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogCancelButton:
+ addIconFiles(u"standardbutton-cancel-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogHelpButton:
+ addIconFiles(u"standardbutton-help-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogOpenButton:
+ addIconFiles(u"standardbutton-open-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogSaveButton:
+ addIconFiles(u"standardbutton-save-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogCloseButton:
+ addIconFiles(u"standardbutton-close-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogApplyButton:
+ addIconFiles(u"standardbutton-apply-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogResetButton:
+ addIconFiles(u"standardbutton-clear-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogDiscardButton:
+ addIconFiles(u"standardbutton-delete-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogYesButton:
+ addIconFiles(u"standardbutton-yes-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DialogNoButton:
+ addIconFiles(u"standardbutton-no-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_CommandLink:
+ case QStyle::SP_ArrowForward:
+ return q->proxy()->standardIcon(rtl(option) ? QStyle::SP_ArrowLeft
+ : QStyle::SP_ArrowRight,
+ option, widget);
+ case QStyle::SP_ArrowBack:
+ return q->proxy()->standardIcon(rtl(option) ? QStyle::SP_ArrowRight
+ : QStyle::SP_ArrowLeft,
+ option, widget);
+ case QStyle::SP_ArrowLeft:
+ addIconFiles(u"left-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_ArrowRight:
+ addIconFiles(u"right-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_ArrowUp:
+ addIconFiles(u"up-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_ArrowDown:
+ addIconFiles(u"down-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DirHomeIcon:
+ case QStyle::SP_DirIcon:
+ addIconFiles(u"dirclosed-", pngIconSizes, icon, QIcon::Normal, QIcon::Off);
+ addIconFiles(u"diropen-", pngIconSizes, icon, QIcon::Normal, QIcon::On);
+ break;
+ case QStyle::SP_DirOpenIcon:
+ addIconFiles(u"diropen-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DirClosedIcon:
+ addIconFiles(u"dirclosed-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DirLinkIcon:
+ addIconFiles(u"dirlink-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DriveCDIcon:
+ addIconFiles(u"cdr-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DriveFDIcon:
+ addIconFiles(u"floppy-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DriveHDIcon:
+ addIconFiles(u"harddrive-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DriveDVDIcon:
+ addIconFiles(u"dvd-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DriveNetIcon:
+ addIconFiles(u"networkdrive-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileIcon:
+ addIconFiles(u"file-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_FileLinkIcon:
+ addIconFiles(u"filelink-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_DesktopIcon:
+ addIconFiles(u"desktop-", {16, 32}, icon);
+ break;
+ case QStyle::SP_TrashIcon:
+ addIconFiles(u"trash-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_ComputerIcon:
+ addIconFiles(u"computer-", {16, 32}, icon);
+ break;
+ case QStyle::SP_BrowserReload:
+ addIconFiles(u"refresh-", {24, 32}, icon);
+ break;
+ case QStyle::SP_BrowserStop:
+ addIconFiles(u"stop-", {24, 32}, icon);
+ break;
+ case QStyle::SP_MediaPlay:
+ addIconFiles(u"media-play-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MediaPause:
+ addIconFiles(u"media-pause-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MediaStop:
+ addIconFiles(u"media-stop-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MediaSeekForward:
+ addIconFiles(u"media-seek-forward-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MediaSeekBackward:
+ addIconFiles(u"media-seek-backward-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MediaSkipForward:
+ addIconFiles(u"media-skip-forward-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MediaSkipBackward:
+ addIconFiles(u"media-skip-backward-", pngIconSizes, icon);
+ break;
+ case QStyle::SP_MediaVolume:
+ addIconFiles(u"media-volume-", {16}, icon);
+ break;
+ case QStyle::SP_MediaVolumeMuted:
+ addIconFiles(u"media-volume-muted-", {16}, icon);
+ break;
+ case QStyle::SP_TitleBarCloseButton:
+ case QStyle::SP_DockWidgetCloseButton:
+ addIconFiles(u"closedock-", dockTitleIconSizes, icon);
+ break;
+ case QStyle::SP_TitleBarMenuButton:
# ifndef QT_NO_IMAGEFORMAT_XPM
icon.addPixmap(titleBarMenuCachedPixmapFromXPM());
# endif
- icon.addFile(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
+ icon.addFile(":/qt-project.org/qmessagebox/images/qtlogo-64.png"_L1);
break;
- case SP_TitleBarNormalButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("normalizedockup-"),
- dockTitleIconSizes, sizeof(dockTitleIconSizes)/sizeof(dockTitleIconSizes[0]), icon);
+ case QStyle::SP_TitleBarNormalButton:
+ addIconFiles(u"normalizedockup-", dockTitleIconSizes, icon);
break;
- case SP_ToolBarHorizontalExtensionButton: {
- QString prefix = iconResourcePrefix() + QStringLiteral("toolbar-ext-h-");
- if (rtl)
- prefix += QStringLiteral("rtl-");
- addIconFiles(prefix, toolBarExtHSizes, sizeof(toolBarExtHSizes)/sizeof(toolBarExtHSizes[0]), icon);
- }
+ case QStyle::SP_ToolBarHorizontalExtensionButton:
+ addIconFiles(rtl(option) ? u"toolbar-ext-h-rtl-" : u"toolbar-ext-h-", toolBarExtHSizes, icon);
+ break;
+ case QStyle::SP_ToolBarVerticalExtensionButton:
+ addIconFiles(u"toolbar-ext-v-", toolBarExtVSizes, icon);
break;
- case SP_ToolBarVerticalExtensionButton:
- addIconFiles(iconResourcePrefix() + QStringLiteral("toolbar-ext-v-"),
- toolBarExtVSizes, sizeof(toolBarExtVSizes)/sizeof(toolBarExtVSizes[0]), icon);
+ case QStyle::SP_TabCloseButton:
+ addIconFiles(u"standardbutton-closetab-", pngIconSizes, icon, QIcon::Normal, QIcon::Off);
+ addIconFiles(u"standardbutton-closetab-down-", pngIconSizes, icon, QIcon::Normal, QIcon::On);
+ addIconFiles(u"standardbutton-closetab-hover-", pngIconSizes, icon, QIcon::Active, QIcon::Off);
break;
+ case QStyle::SP_LineEditClearButton:
+ addIconFiles(u"cleartext-", pngIconSizes, icon);
+ break;
+ default:
+ break;
+ }
+#else // QT_NO_IMAGEFORMAT_PNG
+ Q_UNUSED(standardIcon);
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
#endif // QT_NO_IMAGEFORMAT_PNG
+ return icon;
+}
+
+
+/*!
+ \internal
+*/
+QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
+ const QWidget *widget) const
+{
+ Q_D(const QCommonStyle);
+ QIcon icon;
+
+ icon = d->iconFromWindowsTheme(standardIcon, option, widget);
+ if (!icon.isNull())
+ return icon;
+
+ icon = d->iconFromApplicationTheme(standardIcon, option, widget);
+ if (!icon.isNull())
+ return icon;
+
+ icon = d->iconFromMacTheme(standardIcon, option, widget);
+ if (!icon.isNull())
+ return icon;
+
+ icon = d->iconFromResourceTheme(standardIcon, option, widget);
+ if (!icon.isNull())
+ return icon;
+
+#ifndef QT_NO_IMAGEFORMAT_XPM
+ switch (standardIcon) {
+ case QStyle::SP_TitleBarMenuButton:
+ icon.addPixmap(titleBarMenuCachedPixmapFromXPM());
+ break;
default:
- icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget));
break;
}
+ if (!icon.isNull())
+ return icon;
+#endif
+ icon = proxy()->standardPixmap(standardIcon, option, widget);
return icon;
}
@@ -6453,7 +6196,7 @@ QPixmap QCommonStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &p
}
}
- return QPixmap::fromImage(im);
+ return QPixmap::fromImage(std::move(im));
}
case QIcon::Selected: {
QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
@@ -6463,7 +6206,7 @@ QPixmap QCommonStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &p
painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
painter.fillRect(0, 0, img.width(), img.height(), color);
painter.end();
- return QPixmap::fromImage(img); }
+ return QPixmap::fromImage(std::move(img)); }
case QIcon::Active:
return pixmap;
default:
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index 78c5171717..40ed13d453 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOMMONSTYLE_H
#define QCOMMONSTYLE_H
@@ -97,9 +61,6 @@ protected:
private:
Q_DECLARE_PRIVATE(QCommonStyle)
Q_DISABLE_COPY(QCommonStyle)
-#if QT_CONFIG(animation)
- Q_PRIVATE_SLOT(d_func(), void _q_removeAnimation())
-#endif
};
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h
index aaf0fc2ae3..2fa90a8949 100644
--- a/src/widgets/styles/qcommonstyle_p.h
+++ b/src/widgets/styles/qcommonstyle_p.h
@@ -1,46 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QCOMMONSTYLE_P_H
#define QCOMMONSTYLE_P_H
#include <QtWidgets/private/qtwidgetsglobal_p.h>
+#include "qhash.h"
#include "qcommonstyle.h"
#include "qstyle_p.h"
#if QT_CONFIG(animation)
@@ -127,13 +92,29 @@ public:
int animationFps;
#if QT_CONFIG(animation)
- void _q_removeAnimation();
-
- QList<const QObject*> animationTargets() const;
QStyleAnimation* animation(const QObject *target) const;
void startAnimation(QStyleAnimation *animation) const;
void stopAnimation(const QObject *target) const;
+ void removeAnimation(const QObject *target) const;
+#endif
+ QIcon iconFromWindowsTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const;
+ QIcon iconFromMacTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const;
+ QIcon iconFromApplicationTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const;
+ QIcon iconFromResourceTheme(QCommonStyle::StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const;
+ static bool inline rtl(const QStyleOption *option) {
+ return (option && option->direction == Qt::RightToLeft) ||
+ (!option && QGuiApplication::isRightToLeft());
+ }
+#if QT_CONFIG(animation)
private:
mutable QHash<const QObject*, QStyleAnimation*> animations;
#endif // animation
diff --git a/src/widgets/styles/qcommonstylepixmaps_p.h b/src/widgets/styles/qcommonstylepixmaps_p.h
index 58b979465a..313c5b9375 100644
--- a/src/widgets/styles/qcommonstylepixmaps_p.h
+++ b/src/widgets/styles/qcommonstylepixmaps_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWidgets/private/qtwidgetsglobal_p.h>
@@ -52,6 +16,8 @@
// We mean it.
//
+// the SVG sources for these pixmaps are in styles/images
+
static const char * const check_list_controller_xpm[] = {
"16 16 4 1",
" c None",
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index 8c9c5ffae6..5bdbdb1139 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdrawutil.h"
#include "qbitmap.h"
@@ -80,6 +44,7 @@ private:
/*!
\headerfile <qdrawutil.h>
+ \inmodule QtWidgets
\title Drawing Utility Functions
\sa QPainter
@@ -126,6 +91,20 @@ void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2,
qWarning("qDrawShadeLine: Invalid parameters");
return;
}
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatio();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x1 = qRound(devicePixelRatio * x1);
+ y1 = qRound(devicePixelRatio * y1);
+ x2 = qRound(devicePixelRatio * x2);
+ y2 = qRound(devicePixelRatio * y2);
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ midLineWidth = qRound(devicePixelRatio * midLineWidth);
+ p->translate(0.5, 0.5);
+ }
int tlw = lineWidth*2 + midLineWidth; // total line width
QPen oldPen = p->pen(); // save pen
if (sunken)
@@ -251,10 +230,11 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
lineWidth = qRound(devicePixelRatio * lineWidth);
midLineWidth = qRound(devicePixelRatio * midLineWidth);
+ p->translate(0.5, 0.5);
}
QPen oldPen = p->pen();
@@ -317,7 +297,6 @@ void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
p->setPen(oldPen); // restore pen
}
-
/*!
\fn void qDrawShadePanel(QPainter *painter, int x, int y, int width, int height,
const QPalette &palette, bool sunken,
@@ -359,15 +338,18 @@ void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
PainterStateGuard painterGuard(p);
const qreal devicePixelRatio = p->device()->devicePixelRatio();
+ bool isTranslated = false;
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
painterGuard.save();
const qreal inverseScale = qreal(1) / devicePixelRatio;
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
lineWidth = qRound(devicePixelRatio * lineWidth);
+ p->translate(0.5, 0.5);
+ isTranslated = true;
}
QColor shade = pal.dark().color();
@@ -418,12 +400,14 @@ void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
lines << QLineF(x1--, y1++, x2--, y2);
}
p->drawLines(lines);
- if (fill) // fill with fill color
+ if (fill) { // fill with fill color
+ if (isTranslated)
+ p->translate(-0.5, -0.5);
p->fillRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2, *fill);
+ }
p->setPen(oldPen); // restore pen
}
-
/*!
\internal
This function draws a rectangle with two pixel line width.
@@ -450,14 +434,17 @@ static void qDrawWinShades(QPainter *p,
PainterStateGuard painterGuard(p);
const qreal devicePixelRatio = p->device()->devicePixelRatio();
+ bool isTranslated = false;
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
painterGuard.save();
const qreal inverseScale = qreal(1) / devicePixelRatio;
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
+ p->translate(0.5, 0.5);
+ isTranslated = true;
}
QPen oldPen = p->pen();
@@ -474,8 +461,11 @@ static void qDrawWinShades(QPainter *p,
QPoint d[3] = { QPoint(x+1, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y+1) };
p->setPen(c4);
p->drawPolyline(d, 3);
- if (fill)
+ if (fill) {
+ if (isTranslated)
+ p->translate(-0.5, -0.5);
p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
+ }
}
p->setPen(oldPen);
}
@@ -598,9 +588,10 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c,
p->scale(inverseScale, inverseScale);
x = qRound(devicePixelRatio * x);
y = qRound(devicePixelRatio * y);
- w = qRound(devicePixelRatio * w);
- h = qRound(devicePixelRatio * h);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
lineWidth = qRound(devicePixelRatio * lineWidth);
+ p->translate(0.5, 0.5);
}
QPen oldPen = p->pen();
@@ -618,6 +609,74 @@ void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c,
p->setBrush(oldBrush);
}
+/*!
+ \fn void qDrawPlainRoundedRect(QPainter *painter, int x, int y,
+ int width, int height, qreal rx, qreal ry,
+ const QColor &lineColor, int lineWidth,
+ const QBrush *fill)
+ \since 6.7
+ \relates <qdrawutil.h>
+
+ Draws the plain rounded rectangle beginning at (\a x, \a y)
+ with the given \a width and \a height,
+ using the horizontal \a rx and vertical radius \a ry,
+ specified \a painter, \a lineColor and \a lineWidth.
+ The rectangle's interior is filled with the \a
+ fill brush unless \a fill is \nullptr.
+
+ \warning This function does not look at QWidget::style() or
+ QApplication::style(). Use the drawing functions in QStyle to make
+ widgets that follow the current GUI style.
+
+ Alternatively you can use a QFrame widget and apply the
+ QFrame::setFrameStyle() function to display a plain rectangle:
+
+ \snippet code/src_gui_painting_qdrawutil.cpp 4
+
+ \sa qDrawShadeRect(), QStyle
+*/
+
+// ### Qt7: Pass QPen instead of QColor for frame drawing
+void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h,
+ qreal rx, qreal ry, const QColor &c,
+ int lineWidth, const QBrush *fill)
+{
+ if (w == 0 || h == 0)
+ return;
+ if (Q_UNLIKELY(w < 0 || h < 0 || lineWidth < 0)) {
+ qWarning("qDrawPlainRect: Invalid parameters");
+ }
+
+ PainterStateGuard painterGuard(p);
+ const qreal devicePixelRatio = p->device()->devicePixelRatio();
+ if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
+ painterGuard.save();
+ const qreal inverseScale = qreal(1) / devicePixelRatio;
+ p->scale(inverseScale, inverseScale);
+ x = qRound(devicePixelRatio * x);
+ y = qRound(devicePixelRatio * y);
+ w = devicePixelRatio * w;
+ h = devicePixelRatio * h;
+ lineWidth = qRound(devicePixelRatio * lineWidth);
+ p->translate(0.5, 0.5);
+ }
+
+ p->save();
+ p->setPen(c);
+ p->setBrush(Qt::NoBrush);
+ for (int i=0; i<lineWidth; i++) {
+ QRectF rect(x+i, y+i, w-i*2 - 1, h-i*2 - 1);
+ rect.marginsRemoved(QMarginsF(0.5,0.5,0.5,0.5));
+ p->drawRoundedRect(rect, rx, ry);
+ }
+ if (fill) { // fill with fill color
+ p->setPen(Qt::NoPen);
+ p->setBrush(*fill);
+ p->drawRoundedRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2, rx, ry);
+ }
+ p->restore();
+}
+
/*****************************************************************************
Overloaded functions.
*****************************************************************************/
@@ -770,6 +829,7 @@ void qDrawWinButton(QPainter *p, const QRect &r,
/*!
\fn void qDrawWinPanel(QPainter *painter, const QRect &rect, const QPalette &palette,
bool sunken, const QBrush *fill)
+ \relates <qdrawutil.h>
\overload
Draws the Windows-style panel at the rectangle specified by \a rect using
@@ -825,6 +885,32 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
lineWidth, fill);
}
+/*!
+ \fn void qDrawPlainRoundedRect(QPainter *painter, const QRect &rect,
+ qreal rx, qreal ry,
+ const QColor &lineColor, int lineWidth,
+ const QBrush *fill)
+ \since 6.7
+ \relates <qdrawutil.h>
+ \overload
+
+ Draws the plain rectangle specified by \a rect using
+ the horizontal \a rx and vertical radius \a ry,
+ the given \a painter, \a lineColor and \a lineWidth.
+ The rectangle's interior is filled with the
+ \a fill brush unless \a fill is \nullptr.
+
+ \warning This function does not look at QWidget::style() or
+ QApplication::style(). Use the drawing functions in QStyle to make
+ widgets that follow the current GUI style.
+
+ Alternatively you can use a QFrame widget and apply the
+ QFrame::setFrameStyle() function to display a plain rectangle:
+
+ \snippet code/src_gui_painting_qdrawutil.cpp 9
+
+ \sa qDrawShadeRect(), QStyle
+*/
/*!
\class QTileRules
@@ -866,6 +952,7 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
typedef QVarLengthArray<QPainter::PixmapFragment, 16> QPixmapFragmentsArray;
/*!
+ \relates <qdrawutil.h>
\since 4.6
Draws the indicated \a sourceRect rectangle from the given \a pixmap into
@@ -883,7 +970,7 @@ typedef QVarLengthArray<QPainter::PixmapFragment, 16> QPixmapFragmentsArray;
void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins,
const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins,
const QTileRules &rules
-#ifndef Q_CLANG_QDOC
+#ifndef Q_QDOC
, QDrawBorderPixmap::DrawingHints hints
#endif
)
diff --git a/src/widgets/styles/qdrawutil.h b/src/widgets/styles/qdrawutil.h
index 346029e1b4..26d8d5075f 100644
--- a/src/widgets/styles/qdrawutil.h
+++ b/src/widgets/styles/qdrawutil.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDRAWUTIL_H
#define QDRAWUTIL_H
@@ -107,6 +71,17 @@ Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, co
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
int lineWidth = 1, const QBrush *fill = nullptr);
+Q_WIDGETS_EXPORT void qDrawPlainRoundedRect(QPainter *p, int x, int y, int w, int h,
+ qreal rx, qreal ry, const QColor &, int lineWidth = 1,
+ const QBrush *fill = nullptr);
+
+inline void qDrawPlainRoundedRect(QPainter *painter, const QRect& rect, qreal rx, qreal ry,
+ const QColor &lineColor, int lineWidth = 1,
+ const QBrush *fill = nullptr)
+{
+ qDrawPlainRoundedRect(painter, rect.x(), rect.y(), rect.width(), rect.height(),
+ rx, ry, lineColor, lineWidth, fill);
+}
struct QTileRules
@@ -119,7 +94,7 @@ struct QTileRules
Qt::TileRule vertical;
};
-#ifndef Q_CLANG_QDOC
+#ifndef Q_QDOC
// For internal use only.
namespace QDrawBorderPixmap
{
@@ -151,7 +126,7 @@ Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter,
const QRect &sourceRect,
const QMargins &sourceMargins,
const QTileRules &rules = QTileRules()
-#ifndef Q_CLANG_QDOC
+#ifndef Q_QDOC
, QDrawBorderPixmap::DrawingHints hints = QDrawBorderPixmap::DrawingHints()
#endif
);
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 5772c7d4c4..34a0105b80 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qfusionstyle_p.h"
#include "qfusionstyle_p_p.h"
@@ -93,6 +57,7 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
using namespace QStyleHelper;
enum Direction {
@@ -104,85 +69,12 @@ enum Direction {
// from windows style
static const int windowsItemFrame = 2; // menu item frame width
-static const int windowsItemHMargin = 3; // menu item hor text margin
static const int windowsItemVMargin = 8; // menu item ver text margin
-static const int windowsRightBorder = 15; // right border on windows
static const int groupBoxBottomMargin = 0; // space below the groupbox
static const int groupBoxTopMargin = 3;
#if QT_CONFIG(imageformat_xpm)
-/* XPM */
-static const char * const dock_widget_close_xpm[] = {
- "11 13 7 1",
- " c None",
- ". c #D5CFCB",
- "+ c #8F8B88",
- "@ c #6C6A67",
- "# c #ABA6A3",
- "$ c #B5B0AC",
- "% c #A4A09D",
- " ",
- " +@@@@@@@+ ",
- "+# #+",
- "@ $@ @$ @",
- "@ @@@ @@@ @",
- "@ @@@@@ @",
- "@ @@@ @",
- "@ @@@@@ @",
- "@ @@@ @@@ @",
- "@ $@ @$ @",
- "+% #+",
- " +@@@@@@@+ ",
- " "};
-
-static const char * const dock_widget_restore_xpm[] = {
- "11 13 7 1",
- " c None",
- ". c #D5CFCB",
- "+ c #8F8B88",
- "@ c #6C6A67",
- "# c #ABA6A3",
- "$ c #B5B0AC",
- "% c #A4A09D",
- " ",
- " +@@@@@@@+ ",
- "+# #+",
- "@ #@@@# @",
- "@ @ @ @",
- "@ #@@@# @ @",
- "@ @ @ @ @",
- "@ @ @@@ @",
- "@ @ @ @",
- "@ #@@@# @",
- "+% #+",
- " +@@@@@@@+ ",
- " "};
-
-static const char * const workspace_minimize[] = {
- "11 13 7 1",
- " c None",
- ". c #D5CFCB",
- "+ c #8F8B88",
- "@ c #6C6A67",
- "# c #ABA6A3",
- "$ c #B5B0AC",
- "% c #A4A09D",
- " ",
- " +@@@@@@@+ ",
- "+# #+",
- "@ @",
- "@ @",
- "@ @",
- "@ @@@@@@@ @",
- "@ @@@@@@@ @",
- "@ @",
- "@ @",
- "+% #+",
- " +@@@@@@@+ ",
- " "};
-
-
static const char * const qt_titlebar_context_help[] = {
"10 10 3 1",
" c None",
@@ -253,6 +145,7 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS
return;
const qreal dpi = QStyleHelper::dpi(option);
+ const qreal dpr = painter->device()->devicePixelRatio();
const int arrowWidth = int(QStyleHelper::dpiScaled(14, dpi));
const int arrowHeight = int(QStyleHelper::dpiScaled(8, dpi));
@@ -261,12 +154,12 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS
const int size = qMin(arrowMax, rectMax);
QPixmap cachePixmap;
- QString cacheKey = QStyleHelper::uniqueName(QLatin1String("fusion-arrow"), option, rect.size())
- % HexString<uint>(type)
- % HexString<uint>(color.rgba());
+ const QString cacheKey = QStyleHelper::uniqueName("fusion-arrow"_L1
+ % HexString<uint>(type)
+ % HexString<uint>(color.rgba()),
+ option, rect.size(), dpr);
if (!QPixmapCache::find(cacheKey, &cachePixmap)) {
- cachePixmap = styleCachePixmap(rect.size());
- cachePixmap.fill(Qt::transparent);
+ cachePixmap = styleCachePixmap(rect.size(), dpr);
QPainter cachePainter(&cachePixmap);
QRectF arrowRect;
@@ -277,27 +170,26 @@ static void qt_fusion_draw_arrow(Qt::ArrowType type, QPainter *painter, const QS
arrowRect.moveTo((rect.width() - arrowRect.width()) / 2.0,
(rect.height() - arrowRect.height()) / 2.0);
- QPolygonF triangle;
- triangle.reserve(3);
+ std::array<QPointF, 3> triangle;
switch (type) {
case Qt::DownArrow:
- triangle << arrowRect.topLeft() << arrowRect.topRight() << QPointF(arrowRect.center().x(), arrowRect.bottom());
+ triangle = {arrowRect.topLeft(), arrowRect.topRight(), QPointF(arrowRect.center().x(), arrowRect.bottom())};
break;
case Qt::RightArrow:
- triangle << arrowRect.topLeft() << arrowRect.bottomLeft() << QPointF(arrowRect.right(), arrowRect.center().y());
+ triangle = {arrowRect.topLeft(), arrowRect.bottomLeft(), QPointF(arrowRect.right(), arrowRect.center().y())};
break;
case Qt::LeftArrow:
- triangle << arrowRect.topRight() << arrowRect.bottomRight() << QPointF(arrowRect.left(), arrowRect.center().y());
+ triangle = {arrowRect.topRight(), arrowRect.bottomRight(), QPointF(arrowRect.left(), arrowRect.center().y())};
break;
default:
- triangle << arrowRect.bottomLeft() << arrowRect.bottomRight() << QPointF(arrowRect.center().x(), arrowRect.top());
+ triangle = {arrowRect.bottomLeft(), arrowRect.bottomRight(), QPointF(arrowRect.center().x(), arrowRect.top())};
break;
}
cachePainter.setPen(Qt::NoPen);
cachePainter.setBrush(color);
cachePainter.setRenderHint(QPainter::Antialiasing);
- cachePainter.drawPolygon(triangle);
+ cachePainter.drawPolygon(triangle.data(), int(triangle.size()));
QPixmapCache::insert(cacheKey, cachePixmap);
}
@@ -392,7 +284,7 @@ QFusionStylePrivate::QFusionStylePrivate()
*/
QFusionStyle::QFusionStyle() : QCommonStyle(*new QFusionStylePrivate)
{
- setObjectName(QLatin1String("Fusion"));
+ setObjectName("Fusion"_L1);
}
/*!
@@ -412,37 +304,18 @@ QFusionStyle::~QFusionStyle()
}
/*!
- \fn void QFusionStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette,
- bool enabled, const QString& text, QPalette::ColorRole textRole) const
-
- Draws the given \a text in the specified \a rectangle using the
- provided \a painter and \a palette.
-
- Text is drawn using the painter's pen. If an explicit \a textRole
- is specified, then the text is drawn using the \a palette's color
- for the specified role. The \a enabled value indicates whether or
- not the item is enabled; when reimplementing, this value should
- influence how the item is drawn.
-
- The text is aligned and wrapped according to the specified \a
- alignment.
-
- \sa Qt::Alignment
+ \reimp
*/
void QFusionStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,
bool enabled, const QString& text, QPalette::ColorRole textRole) const
{
+ Q_UNUSED(enabled);
if (text.isEmpty())
return;
QPen savedPen = painter->pen();
- if (textRole != QPalette::NoRole) {
+ if (textRole != QPalette::NoRole)
painter->setPen(QPen(pal.brush(textRole), savedPen.widthF()));
- }
- if (!enabled) {
- QPen pen = painter->pen();
- painter->setPen(pen);
- }
painter->drawText(rect, alignment, text);
painter->setPen(savedPen);
}
@@ -461,10 +334,10 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
QRect rect = option->rect;
int state = option->state;
- QColor outline = d->outline(option->palette);
- QColor highlightedOutline = d->highlightedOutline(option->palette);
+ const QColor outline = d->outline(option->palette);
+ const QColor highlightedOutline = d->highlightedOutline(option->palette);
- QColor tabFrameColor = d->tabFrameColor(option->palette);
+ const QColor tabFrameColor = d->tabFrameColor(option->palette);
switch (elem) {
@@ -472,17 +345,8 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
// No frame drawn
case PE_FrameGroupBox:
{
- QPixmap pixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png"));
- int topMargin = 0;
- auto control = qobject_cast<const QGroupBox *>(widget);
- if (control && !control->isCheckable() && control->title().isEmpty()) {
- // Shrinking the topMargin if Not checkable AND title is empty
- topMargin = groupBoxTopMargin;
- } else {
- topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin;
- }
- QRect frame = option->rect.adjusted(0, topMargin, 0, 0);
- qDrawBorderPixmap(painter, frame, QMargins(6, 6, 6, 6), pixmap);
+ QPixmap pixmap(":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png"_L1);
+ qDrawBorderPixmap(painter, option->rect, QMargins(6, 6, 6, 6), pixmap);
break;
}
#endif // QT_CONFIG(groupbox)
@@ -936,7 +800,7 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault)
buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90);
- BEGIN_STYLE_PIXMAPCACHE(QStringLiteral("pushbutton-") + buttonColor.name(QColor::HexArgb))
+ BEGIN_STYLE_PIXMAPCACHE(u"pushbutton-" + buttonColor.name(QColor::HexArgb))
r = rect.adjusted(0, 1, -1, 0);
p->setRenderHint(QPainter::Antialiasing, true);
@@ -990,17 +854,6 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
case PE_FrameStatusBarItem:
break;
- case PE_IndicatorTabClose:
- {
- Q_D(const QFusionStyle);
- if (d->tabBarcloseButtonIcon.isNull())
- d->tabBarcloseButtonIcon = proxy()->standardIcon(SP_DialogCloseButton, option, widget);
- if ((option->state & State_Enabled) && (option->state & State_MouseOver))
- proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
- QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), painter->device()->devicePixelRatio(), QIcon::Normal, QIcon::On);
- proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
- }
- break;
case PE_PanelMenu: {
painter->save();
const QBrush menuBackground = option->palette.base().color().lighter(108);
@@ -1099,10 +952,13 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
painter->translate(0.5, 0.5);
painter->setBrush(dimHighlight);
painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1);
- QColor innerLine = Qt::white;
- innerLine.setAlpha(40);
- painter->setPen(innerLine);
- painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1);
+ //when the rectangle we get is large enough, draw the inner rectangle.
+ if (option->rect.width() > 2 && option->rect.height() > 2) {
+ QColor innerLine = Qt::white;
+ innerLine.setAlpha(40);
+ painter->setPen(innerLine);
+ painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1);
+ }
painter->restore();
}
break;
@@ -1269,7 +1125,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
Qt::ElideRight, titleRect.width());
proxy()->drawItemText(painter,
titleRect,
- Qt::AlignLeft | Qt::AlignVCenter, dwOpt->palette,
+ Qt::AlignLeft | Qt::AlignVCenter | Qt::TextHideMnemonic, dwOpt->palette,
dwOpt->state & State_Enabled, titleText,
QPalette::WindowText);
}
@@ -1281,22 +1137,22 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
// Draws the header in tables.
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
const QStyleOptionHeaderV2 *headerV2 = qstyleoption_cast<const QStyleOptionHeaderV2 *>(option);
- QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size());
- pixmapName += QString::number(- int(header->position));
- pixmapName += QString::number(- int(header->orientation));
- if (headerV2)
- pixmapName += QString::number(- int(headerV2->isSectionDragTarget));
-
+ const bool isSectionDragTarget = headerV2 ? headerV2->isSectionDragTarget : false;
+ const qreal dpr = painter->device()->devicePixelRatio();
+ const QString pixmapName = QStyleHelper::uniqueName("headersection-"_L1
+ % HexString(header->position)
+ % HexString(header->orientation)
+ % QLatin1Char(isSectionDragTarget ? '1' : '0'),
+ option, option->rect.size(), dpr);
QPixmap cache;
if (!QPixmapCache::find(pixmapName, &cache)) {
- cache = styleCachePixmap(rect.size());
- cache.fill(Qt::transparent);
+ cache = styleCachePixmap(rect.size(), dpr);
QRect pixmapRect(0, 0, rect.width(), rect.height());
QPainter cachePainter(&cache);
QColor buttonColor = d->buttonColor(option->palette);
QColor gradientStartColor = buttonColor.lighter(104);
QColor gradientStopColor = buttonColor.darker(102);
- if (headerV2 && headerV2->isSectionDragTarget) {
+ if (isSectionDragTarget) {
gradientStopColor = gradientStartColor.darker(130);
gradientStartColor = gradientStartColor.darker(130);
}
@@ -1363,36 +1219,39 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
case CE_ProgressBarContents:
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
- painter->translate(0.5, 0.5);
if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- bool vertical = false;
- bool inverted = false;
- bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
- bool complete = bar->progress == bar->maximum;
-
- vertical = !(bar->state & QStyle::State_Horizontal);
- inverted = bar->invertedAppearance;
+ const auto indeterminate = (bar->minimum == 0 && bar->maximum == 0);
+ const auto complete = bar->progress == bar->maximum;
+ const auto vertical = !(bar->state & QStyle::State_Horizontal);
+ const auto inverted = bar->invertedAppearance;
+ const auto reverse = (bar->direction == Qt::RightToLeft) ^ inverted;
// If the orientation is vertical, we use a transform to rotate
- // the progress bar 90 degrees clockwise. This way we can use the
+ // the progress bar 90 degrees (counter)clockwise. This way we can use the
// same rendering code for both orientations.
if (vertical) {
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- QTransform m = QTransform::fromTranslate(rect.height()-1, -1.0);
- m.rotate(90.0);
+ QTransform m;
+ if (inverted) {
+ m.rotate(90);
+ m.translate(0, -rect.height());
+ } else {
+ m.rotate(-90);
+ m.translate(-rect.width(), 0);
+ }
+ painter->setTransform(m, true);
+ } else if (reverse) {
+ QTransform m = QTransform::fromScale(-1, 1);
+ m.translate(-rect.width(), 0);
painter->setTransform(m, true);
}
+ painter->translate(0.5, 0.5);
- int maxWidth = rect.width();
const auto progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
const auto totalSteps = qMax(Q_INT64_C(1), qint64(bar->maximum) - bar->minimum);
const auto progressSteps = qint64(progress) - bar->minimum;
- const auto progressBarWidth = progressSteps * maxWidth / totalSteps;
- int width = indeterminate ? maxWidth : progressBarWidth;
-
- bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
- if (inverted)
- reverse = !reverse;
+ const auto progressBarWidth = progressSteps * rect.width() / totalSteps;
+ int width = indeterminate ? rect.width() : progressBarWidth;
int step = 0;
QRect progressBar;
@@ -1401,28 +1260,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
outline = highlightedoutline;
- if (!indeterminate) {
- QColor innerShadow(Qt::black);
- innerShadow.setAlpha(35);
- painter->setPen(innerShadow);
- if (!reverse) {
- progressBar.setRect(rect.left(), rect.top(), width - 1, rect.height() - 1);
- if (!complete) {
- painter->drawLine(progressBar.topRight() + QPoint(2, 1), progressBar.bottomRight() + QPoint(2, 0));
- painter->setPen(QPen(highlight.darker(140)));
- painter->drawLine(progressBar.topRight() + QPoint(1, 1), progressBar.bottomRight() + QPoint(1, 0));
- }
- } else {
- progressBar.setRect(rect.right() - width - 1, rect.top(), width + 2, rect.height() - 1);
- if (!complete) {
- painter->drawLine(progressBar.topLeft() + QPoint(-2, 1), progressBar.bottomLeft() + QPoint(-2, 0));
- painter->setPen(QPen(highlight.darker(140)));
- painter->drawLine(progressBar.topLeft() + QPoint(-1, 1), progressBar.bottomLeft() + QPoint(-1, 0));
- }
- }
- } else {
+ if (!indeterminate)
+ progressBar.setRect(rect.left(), rect.top(), width - 1, rect.height() - 1);
+ else
progressBar.setRect(rect.left(), rect.top(), rect.width() - 1, rect.height() - 1);
- }
if (indeterminate || bar->progress > bar->minimum) {
@@ -1437,10 +1278,13 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
painter->setBrush(gradient);
painter->save();
+ // 0.5 - half the width of a cosmetic pen (for vertical line below)
if (!complete && !indeterminate)
- painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1));
- QRect fillRect = progressBar.adjusted( !indeterminate && !complete && reverse ? -2 : 0, 0,
- indeterminate || complete || reverse ? 0 : 2, 0);
+ painter->setClipRect(QRectF(progressBar).adjusted(-1, -1, 0.5, 1));
+
+ QRect fillRect = progressBar;
+ if (!indeterminate && !complete)
+ fillRect.setWidth(std::min(fillRect.width() + 2, rect.width() - 1)); // avoid round borders at the right end
painter->drawRoundedRect(fillRect, 2, 2);
painter->restore();
@@ -1467,43 +1311,63 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
x + rect.height() + step, progressBar.top() - 2);
}
}
+ if (!indeterminate && !complete) {
+ QColor innerShadow(Qt::black);
+ innerShadow.setAlpha(35);
+ painter->setPen(innerShadow);
+ painter->drawLine(progressBar.topRight() + QPoint(2, 1), progressBar.bottomRight() + QPoint(2, 0));
+ painter->setPen(QPen(highlight.darker(140)));
+ painter->drawLine(progressBar.topRight() + QPoint(1, 1), progressBar.bottomRight() + QPoint(1, 0));
+ }
}
painter->restore();
break;
case CE_ProgressBarLabel:
if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- QRect leftRect;
QRect rect = bar->rect;
+ QRect leftRect = rect;
+ QRect rightRect = rect;
QColor textColor = option->palette.text().color();
QColor alternateTextColor = d->highlightedText(option->palette);
painter->save();
- bool vertical = false, inverted = false;
- vertical = !(bar->state & QStyle::State_Horizontal);
- inverted = bar->invertedAppearance;
- if (vertical)
- rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
+ const auto vertical = !(bar->state & QStyle::State_Horizontal);
+ const auto inverted = bar->invertedAppearance;
+ const auto reverse = (bar->direction == Qt::RightToLeft) ^ inverted;
const auto totalSteps = qMax(Q_INT64_C(1), qint64(bar->maximum) - bar->minimum);
const auto progressSteps = qint64(bar->progress) - bar->minimum;
- const auto progressIndicatorPos = progressSteps * rect.width() / totalSteps;
- if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
- leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
- if (vertical)
- leftRect.translate(rect.width() - progressIndicatorPos, 0);
-
- bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted) ||
- ((bar->direction == Qt::LeftToRight) && inverted)));
-
- QRegion rightRect = rect;
- rightRect = rightRect.subtracted(leftRect);
- painter->setClipRegion(rightRect);
- painter->setPen(flip ? alternateTextColor : textColor);
- painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
- if (!leftRect.isNull()) {
- painter->setPen(flip ? textColor : alternateTextColor);
- painter->setClipRect(leftRect);
- painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
+ const auto progressIndicatorPos = progressSteps * (vertical ? rect.height() : rect.width()) / totalSteps;
+
+ if (vertical) {
+ if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.height()) {
+ if (inverted) {
+ leftRect.setHeight(progressIndicatorPos);
+ rightRect.setY(progressIndicatorPos);
+ } else {
+ leftRect.setHeight(rect.height() - progressIndicatorPos);
+ rightRect.setY(rect.height() - progressIndicatorPos);
+ }
+ }
+ } else {
+ if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width()) {
+ if (reverse) {
+ leftRect.setWidth(rect.width() - progressIndicatorPos);
+ rightRect.setX(rect.width() - progressIndicatorPos);
+ } else {
+ leftRect.setWidth(progressIndicatorPos);
+ rightRect.setX(progressIndicatorPos);
+ }
+ }
}
+
+ const auto firstIsAlternateColor = (vertical && !inverted) || (!vertical && reverse);
+ painter->setClipRect(rightRect);
+ painter->setPen(firstIsAlternateColor ? alternateTextColor : textColor);
+ painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
+ painter->setPen(firstIsAlternateColor ? textColor : alternateTextColor);
+ painter->setClipRect(leftRect);
+ painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
+
painter->restore();
}
break;
@@ -1556,34 +1420,37 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
const int margin = int(QStyleHelper::dpiScaled(5, option));
if (!menuItem->text.isEmpty()) {
painter->setFont(menuItem->font);
- proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0), Qt::AlignLeft | Qt::AlignVCenter,
+ proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0),
+ Qt::AlignLeft | Qt::AlignVCenter,
menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
QPalette::Text);
w = menuItem->fontMetrics.horizontalAdvance(menuItem->text) + margin;
}
painter->setPen(shadow.lighter(106));
- bool reverse = menuItem->direction == Qt::RightToLeft;
- painter->drawLine(menuItem->rect.left() + margin + (reverse ? 0 : w), menuItem->rect.center().y(),
- menuItem->rect.right() - margin - (reverse ? w : 0), menuItem->rect.center().y());
+ const bool reverse = menuItem->direction == Qt::RightToLeft;
+ qreal y = menuItem->rect.center().y() + 0.5f;
+ painter->drawLine(QPointF(menuItem->rect.left() + margin + (reverse ? 0 : w), y),
+ QPointF(menuItem->rect.right() - margin - (reverse ? w : 0), y));
painter->restore();
break;
}
- bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
+ const bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
if (selected) {
QRect r = option->rect;
painter->fillRect(r, highlight);
painter->setPen(QPen(highlightOutline));
painter->drawRect(QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5));
}
- bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
- bool checked = menuItem->checked;
- bool sunken = menuItem->state & State_Sunken;
- bool enabled = menuItem->state & State_Enabled;
+ const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
+ const bool checked = menuItem->checked;
+ const bool sunken = menuItem->state & State_Sunken;
+ const bool enabled = menuItem->state & State_Enabled;
- bool ignoreCheckMark = false;
- const int checkColHOffset = windowsItemHMargin + windowsItemFrame - 1;
+ const int checkColHOffset = QFusionStylePrivate::menuItemHMargin + windowsItemFrame - 1;
+ // icon checkbox's highlight column width
int checkcol = qMax<int>(menuItem->rect.height() * 0.79,
- qMax<int>(menuItem->maxIconWidth, dpiScaled(21, option))); // icon checkbox's highlight column width
+ qMax<int>(menuItem->maxIconWidth, dpiScaled(21, option)));
+ bool ignoreCheckMark = false;
if (
#if QT_CONFIG(combobox)
qobject_cast<const QComboBox*>(widget) ||
@@ -1595,8 +1462,9 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
// Check, using qreal and QRectF to avoid error accumulation
const qreal boxMargin = dpiScaled(3.5, option);
const qreal boxWidth = checkcol - 2 * boxMargin;
- QRectF checkRectF(option->rect.left() + boxMargin + checkColHOffset, option->rect.center().y() - boxWidth/2 + 1, boxWidth, boxWidth);
- QRect checkRect = checkRectF.toRect();
+ QRect checkRect = QRectF(option->rect.left() + boxMargin + checkColHOffset,
+ option->rect.center().y() - boxWidth/2 + 1, boxWidth,
+ boxWidth).toRect();
checkRect.setWidth(checkRect.height()); // avoid .toRect() round error results in non-perfect square
checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect);
if (checkable) {
@@ -1606,8 +1474,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
- QPalette::ColorRole textRole = !enabled ? QPalette::Text:
- selected ? QPalette::HighlightedText : QPalette::ButtonText;
+ QPalette::ColorRole textRole = !enabled
+ ? QPalette::Text :
+ selected ? QPalette::HighlightedText
+ : QPalette::ButtonText;
painter->setBrush(option->palette.brush( option->palette.currentColorGroup(), textRole));
const int adjustment = checkRect.height() * 0.3;
painter->drawEllipse(checkRect.adjusted(adjustment, adjustment, -adjustment, -adjustment));
@@ -1634,8 +1504,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
}
// Text and icon, ripped from windows style
- bool dis = !(menuItem->state & State_Enabled);
- bool act = menuItem->state & State_Selected;
+ const bool dis = !(menuItem->state & State_Enabled);
+ const bool act = menuItem->state & State_Selected;
const QStyleOption *opt = option;
const QStyleOptionMenuItem *menuitem = menuItem;
@@ -1660,10 +1530,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
else
pixmap = menuItem->icon.pixmap(iconSize, painter->device()->devicePixelRatio(), mode);
- const int pixw = pixmap.width() / pixmap.devicePixelRatio();
- const int pixh = pixmap.height() / pixmap.devicePixelRatio();
-
- QRect pmr(0, 0, pixw, pixh);
+ QRect pmr(QPoint(0, 0), pixmap.deviceIndependentSize().toSize());
pmr.moveCenter(vCheckRect.center());
painter->setPen(menuItem->palette.text().color());
if (!ignoreCheckMark && checkable && checked) {
@@ -1686,36 +1553,38 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
}
int x, y, w, h;
menuitem->rect.getRect(&x, &y, &w, &h);
- int tab = menuitem->reservedShortcutWidth;
QColor discol;
if (dis) {
discol = menuitem->palette.text().color();
p->setPen(discol);
}
- int xm = checkColHOffset + checkcol + windowsItemHMargin;
- int xpos = menuitem->rect.x() + xm;
+ const int xm = checkColHOffset + checkcol + QFusionStylePrivate::menuItemHMargin;
+ const int xpos = menuitem->rect.x() + xm;
- QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
- QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
+ const QRect textRect(xpos, y + windowsItemVMargin,
+ w - xm - QFusionStylePrivate::menuRightBorder - menuitem->reservedShortcutWidth + 2,
+ h - 2 * windowsItemVMargin);
+ const QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
QStringView s(menuitem->text);
if (!s.isEmpty()) { // draw text
p->save();
- int t = s.indexOf(QLatin1Char('\t'));
+ const qsizetype tabIndex = s.indexOf(u'\t');
int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
text_flags |= Qt::TextHideMnemonic;
text_flags |= Qt::AlignLeft;
- if (t >= 0) {
+ if (tabIndex >= 0) {
QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
- QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
- const QString textToDraw = s.mid(t + 1).toString();
+ QRect(textRect.topRight(),
+ QPoint(menuitem->rect.right(), textRect.bottom())));
+ const QString textToDraw = s.mid(tabIndex + 1).toString();
if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
p->setPen(discol);
}
p->drawText(vShortcutRect, text_flags, textToDraw);
- s = s.left(t);
+ s = s.left(tabIndex);
}
QFont font = menuitem->font;
// font may not have any "hard" flags set. We override
@@ -1729,23 +1598,25 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
font.setBold(true);
p->setFont(font);
- QString textToDraw = s.left(t).toString();
+ const QFontMetrics fontMetrics(font);
+ const QString textToDraw = fontMetrics.elidedText(s.left(tabIndex).toString(),
+ Qt::ElideMiddle, vTextRect.width(),
+ text_flags);
if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
p->setPen(discol);
}
- textToDraw = menuitem->fontMetrics.elidedText(textToDraw, Qt::ElideMiddle, vTextRect.width());
p->drawText(vTextRect, text_flags, textToDraw);
p->restore();
}
// Arrow
if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
- int dim = (menuItem->rect.height() - 4) / 2;
+ const int dim = (menuItem->rect.height() - 4) / 2;
PrimitiveElement arrow;
arrow = option->direction == Qt::RightToLeft ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
- int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim;
+ const int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim;
QRect vSubMenuRect = visualRect(option->direction, menuItem->rect,
QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim));
QStyleOptionMenuItem newMI = *menuItem;
@@ -1957,7 +1828,23 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
frame.lineWidth = groupBox->lineWidth;
frame.midLineWidth = groupBox->midLineWidth;
frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
+ painter->save();
+ QRegion region(groupBox->rect);
+ if (!groupBox->text.isEmpty()) {
+ bool ltr = groupBox->direction == Qt::LeftToRight;
+ QRect finalRect;
+ if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) {
+ finalRect = checkBoxRect.united(textRect);
+ finalRect.adjust(ltr ? -4 : -2, 0, ltr ? 2 : 4, 0);
+ } else {
+ finalRect = textRect;
+ finalRect.adjust(-2, 0, 2, 0);
+ }
+ region -= finalRect.adjusted(0, 0, 0, 3 - textRect.height() / 2);
+ }
+ painter->setClipRegion(region);
proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
+ painter->restore();
}
// Draw title
@@ -1992,12 +1879,12 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
#if QT_CONFIG(spinbox)
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
+ const qreal dpr = painter->device()->devicePixelRatio();
QPixmap cache;
- QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
+ QString pixmapName = QStyleHelper::uniqueName("spinbox"_L1, spinBox, spinBox->rect.size(), dpr);
if (!QPixmapCache::find(pixmapName, &cache)) {
- cache = styleCachePixmap(spinBox->rect.size());
- cache.fill(Qt::transparent);
+ cache = styleCachePixmap(spinBox->rect.size(), dpr);
QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height());
QRect rect = pixmapRect;
@@ -2032,22 +1919,24 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
cachePainter.setPen(d->topShadow());
cachePainter.drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
- // Draw button gradient
- QColor buttonColor = d->buttonColor(option->palette);
- QRect updownRect = upRect.adjusted(0, -2, 0, downRect.height() + 2);
- QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104));
+ if (!upRect.isNull()) {
+ // Draw button gradient
+ const QColor buttonColor = d->buttonColor(option->palette);
+ const QRect updownRect = upRect.adjusted(0, -2, 0, downRect.height() + 2);
+ const QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled && option->state & State_MouseOver )
+ ? buttonColor : buttonColor.darker(104));
- // Draw button gradient
- cachePainter.setPen(Qt::NoPen);
- cachePainter.setBrush(gradient);
+ cachePainter.setPen(Qt::NoPen);
+ cachePainter.setBrush(gradient);
- cachePainter.save();
- cachePainter.setClipRect(updownRect);
- cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
- cachePainter.setPen(QPen(d->innerContrastLine()));
- cachePainter.setBrush(Qt::NoBrush);
- cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 2, 2);
- cachePainter.restore();
+ cachePainter.save();
+ cachePainter.setClipRect(updownRect);
+ cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2);
+ cachePainter.setPen(QPen(d->innerContrastLine()));
+ cachePainter.setBrush(Qt::NoBrush);
+ cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 2, 2);
+ cachePainter.restore();
+ }
if ((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) && upIsActive) {
if (sunken)
@@ -2075,12 +1964,14 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
cachePainter.restore();
}
- // outline the up/down buttons
- cachePainter.setPen(outline);
- if (spinBox->direction == Qt::RightToLeft) {
- cachePainter.drawLine(upRect.right(), upRect.top() - 1, upRect.right(), downRect.bottom() + 1);
- } else {
- cachePainter.drawLine(upRect.left(), upRect.top() - 1, upRect.left(), downRect.bottom() + 1);
+ if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
+ // buttonSymbols == NoButtons results in 'null' rects
+ // and a tiny rect painted in the corner.
+ cachePainter.setPen(outline);
+ if (spinBox->direction == Qt::RightToLeft)
+ cachePainter.drawLine(QLineF(upRect.right(), upRect.top() - 0.5, upRect.right(), downRect.bottom() + 1.5));
+ else
+ cachePainter.drawLine(QLineF(upRect.left(), upRect.top() - 0.5, upRect.left(), downRect.bottom() + 1.5));
}
if (upIsActive && sunken) {
@@ -2555,7 +2446,6 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
subtleEdge.setAlpha(40);
painter->setPen(subtleEdge);
painter->setBrush(Qt::NoBrush);
- painter->setClipRect(scrollBarGroove.adjusted(1, 0, -1, -3));
painter->drawRect(scrollBarGroove.adjusted(1, 0, -1, -1));
painter->restore();
}
@@ -2595,10 +2485,12 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
painter->setBrush(midColor2);
else if (option->state & State_MouseOver && scrollBar->activeSubControls & SC_ScrollBarSlider)
painter->setBrush(highlightedGradient);
- else
+ else if (!isDarkBg)
painter->setBrush(gradient);
+ else
+ painter->setBrush(midColor2);
- painter->drawRect(pixmapRect.adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : 1, horizontal ? 1 : 0));
+ painter->drawRect(pixmapRect.adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : -1, horizontal ? -1 : 0));
painter->setPen(d->innerContrastLine());
painter->drawRect(scrollBarSlider.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, -1, -1));
@@ -2628,16 +2520,9 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0));
painter->setPen(QPen(alphaOutline));
if (option->state & State_Horizontal) {
- if (option->direction == Qt::RightToLeft) {
- pixmapRect.setLeft(scrollBarSubLine.left());
- painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft());
- } else {
- pixmapRect.setRight(scrollBarSubLine.right());
- painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
- }
+ painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, 0, horizontal ? 1 : 0, horizontal ? -1 : 0));
} else {
- pixmapRect.setBottom(scrollBarSubLine.bottom());
- painter->drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight());
+ painter->drawRect(scrollBarSubLine.adjusted(0, 0, horizontal ? 0 : -1, 0));
}
QRect upRect = scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, horizontal ? -2 : -1, horizontal ? -1 : -2);
@@ -2665,16 +2550,9 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
painter->drawRect(scrollBarAddLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0));
painter->setPen(QPen(alphaOutline, 1));
if (option->state & State_Horizontal) {
- if (option->direction == Qt::LeftToRight) {
- pixmapRect.setLeft(scrollBarAddLine.left());
- painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft());
- } else {
- pixmapRect.setRight(scrollBarAddLine.right());
- painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
- }
+ painter->drawRect(scrollBarAddLine.adjusted(horizontal ? -1 : 0, 0, horizontal ? -1 : 0, horizontal ? -1 : 0));
} else {
- pixmapRect.setTop(scrollBarAddLine.top());
- painter->drawLine(pixmapRect.topLeft(), pixmapRect.topRight());
+ painter->drawRect(scrollBarAddLine.adjusted(0, horizontal ? 0 : -1, horizontal ? 0 : -1, horizontal ? 0 : -1));
}
QRect downRect = scrollBarAddLine.adjusted(1, 1, -1, -1);
@@ -2690,7 +2568,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
}
painter->restore();
- break;;
+ break;
#endif // QT_CONFIG(slider)
case CC_ComboBox:
painter->save();
@@ -2698,20 +2576,16 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
bool hasFocus = option->state & State_HasFocus && option->state & State_KeyboardFocusChange;
bool sunken = comboBox->state & State_On; // play dead, if combobox has no items
bool isEnabled = (comboBox->state & State_Enabled);
+ const qreal dpr = painter->device()->devicePixelRatio();
QPixmap cache;
- QString pixmapName = QStyleHelper::uniqueName(QLatin1String("combobox"), option, comboBox->rect.size());
- if (sunken)
- pixmapName += QLatin1String("-sunken");
- if (comboBox->editable)
- pixmapName += QLatin1String("-editable");
- if (isEnabled)
- pixmapName += QLatin1String("-enabled");
- if (!comboBox->frame)
- pixmapName += QLatin1String("-frameless");
-
+ const QString pixmapName = QStyleHelper::uniqueName("combobox"_L1
+ % QLatin1StringView(sunken ? "-sunken" : "")
+ % QLatin1StringView(comboBox->editable ? "-editable" : "")
+ % QLatin1StringView(isEnabled ? "-enabled" : "")
+ % QLatin1StringView(!comboBox->frame ? "-frameless" : ""),
+ option, comboBox->rect.size(), dpr);
if (!QPixmapCache::find(pixmapName, &cache)) {
- cache = styleCachePixmap(comboBox->rect.size());
- cache.fill(Qt::transparent);
+ cache = styleCachePixmap(comboBox->rect.size(), dpr);
QPainter cachePainter(&cache);
QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height());
QStyleOptionComboBox comboBoxCopy = *comboBox;
@@ -2799,6 +2673,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
#if QT_CONFIG(slider)
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+ const qreal dpr = painter->device()->devicePixelRatio();
QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
@@ -2820,13 +2695,13 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
grooveColor.setHsv(buttonColor.hue(),
qMin(255, (int)(buttonColor.saturation())),
qMin(255, (int)(buttonColor.value()*0.9)));
- QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_groove"), option, groove.size());
+ QString groovePixmapName = QStyleHelper::uniqueName("slider_groove"_L1, option,
+ groove.size(), dpr);
QRect pixmapRect(0, 0, groove.width(), groove.height());
// draw background groove
if (!QPixmapCache::find(groovePixmapName, &cache)) {
- cache = styleCachePixmap(pixmapRect.size());
- cache.fill(Qt::transparent);
+ cache = styleCachePixmap(pixmapRect.size(), dpr);
QPainter groovePainter(&cache);
groovePainter.setRenderHint(QPainter::Antialiasing, true);
groovePainter.translate(0.5, 0.5);
@@ -2851,10 +2726,10 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
// draw blue groove highlight
QRect clipRect;
- groovePixmapName += QLatin1String("_blue");
+ if (!groovePixmapName.isEmpty())
+ groovePixmapName += "_blue"_L1;
if (!QPixmapCache::find(groovePixmapName, &cache)) {
- cache = styleCachePixmap(pixmapRect.size());
- cache.fill(Qt::transparent);
+ cache = styleCachePixmap(pixmapRect.size(), dpr);
QPainter groovePainter(&cache);
QLinearGradient gradient;
if (horizontal) {
@@ -2867,13 +2742,13 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
}
QColor highlight = d->highlight(option->palette);
QColor highlightedoutline = highlight.darker(140);
- if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
- outline = highlightedoutline;
-
+ QColor grooveOutline = outline;
+ if (qGray(grooveOutline.rgb()) > qGray(highlightedoutline.rgb()))
+ grooveOutline = highlightedoutline;
groovePainter.setRenderHint(QPainter::Antialiasing, true);
groovePainter.translate(0.5, 0.5);
- groovePainter.setPen(QPen(outline));
+ groovePainter.setPen(QPen(grooveOutline));
gradient.setColorAt(0, activeHighlight);
gradient.setColorAt(1, activeHighlight.lighter(130));
groovePainter.setBrush(gradient);
@@ -2888,10 +2763,11 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
if (slider->upsideDown)
clipRect = QRect(handle.right(), groove.top(), groove.right() - handle.right(), groove.height());
else
- clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height());
+ clipRect = QRect(groove.left(), groove.top(),
+ handle.left() - slider->rect.left(), groove.height());
} else {
if (slider->upsideDown)
- clipRect = QRect(groove.left(), handle.bottom(), groove.width(), groove.height() - handle.bottom());
+ clipRect = QRect(groove.left(), handle.bottom(), groove.width(), groove.height() - (handle.bottom() - slider->rect.top()));
else
clipRect = QRect(groove.left(), groove.top(), groove.width(), handle.top() - groove.top());
}
@@ -2902,6 +2778,8 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
}
if (option->subControls & SC_SliderTickmarks) {
+ painter->save();
+ painter->translate(slider->rect.x(), slider->rect.y());
painter->setPen(outline);
int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
@@ -2919,6 +2797,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
int v = slider->minimum;
int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
+ QVector<QLine> lines;
while (v <= slider->maximum + 1) {
if (v == slider->maximum + 1 && interval == 1)
break;
@@ -2932,21 +2811,21 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
if (horizontal) {
if (ticksAbove) {
- painter->drawLine(pos, slider->rect.top() + extra,
- pos, slider->rect.top() + tickSize);
+ lines += QLine(pos, slider->rect.top() + extra,
+ pos, slider->rect.top() + tickSize);
}
if (ticksBelow) {
- painter->drawLine(pos, slider->rect.bottom() - extra,
- pos, slider->rect.bottom() - tickSize);
+ lines += QLine(pos, slider->rect.bottom() - extra,
+ pos, slider->rect.bottom() - tickSize);
}
} else {
if (ticksAbove) {
- painter->drawLine(slider->rect.left() + extra, pos,
- slider->rect.left() + tickSize, pos);
+ lines += QLine(slider->rect.left() + extra, pos,
+ slider->rect.left() + tickSize, pos);
}
if (ticksBelow) {
- painter->drawLine(slider->rect.right() - extra, pos,
- slider->rect.right() - tickSize, pos);
+ lines += QLine(slider->rect.right() - extra, pos,
+ slider->rect.right() - tickSize, pos);
}
}
// in the case where maximum is max int
@@ -2955,13 +2834,15 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
break;
v = nextInterval;
}
+ painter->drawLines(lines);
+ painter->restore();
}
// draw handle
if ((option->subControls & SC_SliderHandle) ) {
- QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
+ QString handlePixmapName = QStyleHelper::uniqueName("slider_handle"_L1, option,
+ handle.size(), dpr);
if (!QPixmapCache::find(handlePixmapName, &cache)) {
- cache = styleCachePixmap(handle.size());
- cache.fill(Qt::transparent);
+ cache = styleCachePixmap(handle.size(), dpr);
QRect pixmapRect(0, 0, handle.width(), handle.height());
QPainter handlePainter(&cache);
QRect gradRect = pixmapRect.adjusted(2, 2, -2, -2);
@@ -2975,7 +2856,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
handlePainter.setPen(Qt::NoPen);
handlePainter.setBrush(QColor(0, 0, 0, 40));
- handlePainter.drawRect(r.adjusted(-1, 2, 1, -2));
+ handlePainter.drawRect(horizontal ? r.adjusted(-1, 2, 1, -2) : r.adjusted(2, -1, -2, 1));
handlePainter.setPen(QPen(d->outline(option->palette)));
if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
@@ -3045,7 +2926,6 @@ int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, co
case PM_ListViewIconSize:
val = 24;
break;
- case PM_DialogButtonsSeparator:
case PM_ScrollBarSliderMin:
val = 26;
break;
@@ -3160,7 +3040,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti
break;
case CT_GroupBox:
if (option) {
- int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin;
+ int topMargin = qMax(pixelMetric(PM_IndicatorHeight, option, widget), option->fontMetrics.height()) + groupBoxTopMargin;
newSize += QSize(10, topMargin); // Add some space below the groupbox
}
break;
@@ -3186,22 +3066,22 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti
case CT_MenuItem:
if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
int w = size.width(); // Don't rely of QCommonStyle's width calculation here
- int maxpmw = menuItem->maxIconWidth;
- int tabSpacing = 20;
- if (menuItem->text.contains(QLatin1Char('\t')))
- w += tabSpacing;
+ if (menuItem->text.contains(u'\t'))
+ w += menuItem->reservedShortcutWidth;
else if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu)
w += 2 * QStyleHelper::dpiScaled(QFusionStylePrivate::menuArrowHMargin, option);
else if (menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem) {
- QFontMetrics fm(menuItem->font);
+ const QFontMetrics fm(menuItem->font);
QFont fontBold = menuItem->font;
fontBold.setBold(true);
- QFontMetrics fmBold(fontBold);
+ const QFontMetrics fmBold(fontBold);
w += fmBold.horizontalAdvance(menuItem->text) - fm.horizontalAdvance(menuItem->text);
}
const qreal dpi = QStyleHelper::dpi(option);
- const int checkcol = qMax<int>(maxpmw, QStyleHelper::dpiScaled(QFusionStylePrivate::menuCheckMarkWidth, dpi)); // Windows always shows a check column
- w += checkcol;
+ // Windows always shows a check column
+ const int checkcol = qMax<int>(menuItem->maxIconWidth,
+ QStyleHelper::dpiScaled(QFusionStylePrivate::menuCheckMarkWidth, dpi));
+ w += checkcol + windowsItemFrame;
w += QStyleHelper::dpiScaled(int(QFusionStylePrivate::menuRightBorder) + 10, dpi);
newSize.setWidth(w);
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
@@ -3342,23 +3222,28 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
switch (subControl) {
case SC_SliderHandle: {
+ const bool bothTicks = (slider->tickPosition & QSlider::TicksBothSides) == QSlider::TicksBothSides;
if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(proxy()->pixelMetric(PM_SliderThickness, option));
- rect.setWidth(proxy()->pixelMetric(PM_SliderLength, option));
+ rect.setHeight(proxy()->pixelMetric(PM_SliderThickness, option, widget));
+ rect.setWidth(proxy()->pixelMetric(PM_SliderLength, option, widget));
int centerY = slider->rect.center().y() - rect.height() / 2;
- if (slider->tickPosition & QSlider::TicksAbove)
- centerY += tickSize;
- if (slider->tickPosition & QSlider::TicksBelow)
- centerY -= tickSize;
+ if (!bothTicks) {
+ if (slider->tickPosition & QSlider::TicksAbove)
+ centerY += tickSize;
+ if (slider->tickPosition & QSlider::TicksBelow)
+ centerY -= tickSize - 1;
+ }
rect.moveTop(centerY);
} else {
- rect.setWidth(proxy()->pixelMetric(PM_SliderThickness, option));
- rect.setHeight(proxy()->pixelMetric(PM_SliderLength, option));
+ rect.setWidth(proxy()->pixelMetric(PM_SliderThickness, option, widget));
+ rect.setHeight(proxy()->pixelMetric(PM_SliderLength, option, widget));
int centerX = slider->rect.center().x() - rect.width() / 2;
- if (slider->tickPosition & QSlider::TicksAbove)
- centerX += tickSize;
- if (slider->tickPosition & QSlider::TicksBelow)
- centerX -= tickSize;
+ if (!bothTicks) {
+ if (slider->tickPosition & QSlider::TicksAbove)
+ centerX += tickSize;
+ if (slider->tickPosition & QSlider::TicksBelow)
+ centerX -= tickSize - 1;
+ }
rect.moveLeft(centerX);
}
}
@@ -3366,18 +3251,23 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
case SC_SliderGroove: {
QPoint grooveCenter = slider->rect.center();
const int grooveThickness = QStyleHelper::dpiScaled(7, option);
+ const bool bothTicks = (slider->tickPosition & QSlider::TicksBothSides) == QSlider::TicksBothSides;
if (slider->orientation == Qt::Horizontal) {
rect.setHeight(grooveThickness);
- if (slider->tickPosition & QSlider::TicksAbove)
- grooveCenter.ry() += tickSize;
- if (slider->tickPosition & QSlider::TicksBelow)
- grooveCenter.ry() -= tickSize;
+ if (!bothTicks) {
+ if (slider->tickPosition & QSlider::TicksAbove)
+ grooveCenter.ry() += tickSize;
+ if (slider->tickPosition & QSlider::TicksBelow)
+ grooveCenter.ry() -= tickSize - 1;
+ }
} else {
rect.setWidth(grooveThickness);
- if (slider->tickPosition & QSlider::TicksAbove)
- grooveCenter.rx() += tickSize;
- if (slider->tickPosition & QSlider::TicksBelow)
- grooveCenter.rx() -= tickSize;
+ if (!bothTicks) {
+ if (slider->tickPosition & QSlider::TicksAbove)
+ grooveCenter.rx() += tickSize;
+ if (slider->tickPosition & QSlider::TicksBelow)
+ grooveCenter.rx() -= tickSize - 1;
+ }
}
rect.moveCenter(grooveCenter);
break;
@@ -3420,6 +3310,7 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
break;
case SC_SpinBoxFrame:
rect = spinbox->rect;
+ break;
default:
break;
}
@@ -3429,18 +3320,19 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
#endif // QT_CONFIG(spinbox)
case CC_GroupBox:
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- rect = option->rect;
+ const int groupBoxTextAlignment = groupBox->textAlignment;
+ const bool hasVerticalAlignment = (groupBoxTextAlignment & Qt::AlignVertical_Mask) == Qt::AlignVCenter;
+ const int fontMetricsHeight = groupBox->text.isEmpty() ? 0 : groupBox->fontMetrics.height();
+
if (subControl == SC_GroupBoxFrame)
- return rect.adjusted(0, 0, 0, 0);
+ return rect;
else if (subControl == SC_GroupBoxContents) {
QRect frameRect = option->rect.adjusted(0, 0, 0, -groupBoxBottomMargin);
int margin = 3;
int leftMarginExtension = 0;
- const int exclusiveIndicatorHeight = option->subControls.testFlag(SC_GroupBoxCheckBox) ?
- pixelMetric(PM_ExclusiveIndicatorHeight) : 0;
- const int fontMetricsHeight = groupBox->text.isEmpty() ? 0 :
- groupBox->fontMetrics.height();
- const int topMargin = qMax(exclusiveIndicatorHeight, fontMetricsHeight) +
+ const int indicatorHeight = option->subControls.testFlag(SC_GroupBoxCheckBox) ?
+ pixelMetric(PM_IndicatorHeight, option, widget) : 0;
+ const int topMargin = qMax(indicatorHeight, fontMetricsHeight) +
groupBoxTopMargin;
return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin);
}
@@ -3455,12 +3347,17 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
rect = QRect();
if (option->rect.width() > width) {
- switch (groupBox->textAlignment & Qt::AlignHorizontal_Mask) {
+ switch (groupBoxTextAlignment & Qt::AlignHorizontal_Mask) {
case Qt::AlignHCenter:
rect.moveLeft((option->rect.width() - width) / 2);
break;
case Qt::AlignRight:
- rect.moveLeft(option->rect.width() - width);
+ rect.moveLeft(option->rect.width() - width
+ - (hasVerticalAlignment ? proxy()->pixelMetric(PM_LayoutRightMargin, groupBox, widget) : 0));
+ break;
+ case Qt::AlignLeft:
+ if (hasVerticalAlignment)
+ rect.moveLeft(proxy()->pixelMetric(PM_LayoutLeftMargin, option, widget));
break;
}
}
@@ -3712,6 +3609,17 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW
mask->region -= QRect(option->rect.right() , option->rect.top() + 3, 1, 2);
return 1;
}
+ break;
+ case SH_GroupBox_TextLabelVerticalAlignment: {
+ if (const auto *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
+ if (groupBox) {
+ const auto vAlign = groupBox->textAlignment & Qt::AlignVertical_Mask;
+ // default fusion style is AlignTop
+ return vAlign == 0 ? Qt::AlignTop : vAlign;
+ }
+ }
+ break;
+ }
default:
break;
}
@@ -3754,22 +3662,47 @@ QRect QFusionStyle::subElementRect(SubElement sr, const QStyleOption *opt, const
/*!
\reimp
*/
-QIcon QFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
- const QWidget *widget) const
+QIcon QFusionStyle::iconFromTheme(StandardPixmap standardIcon) const
{
-#if QT_CONFIG(imageformat_xpm)
+ QIcon icon;
+#if QT_CONFIG(imageformat_png)
+ auto addIconFiles = [](QStringView prefix, QIcon &icon)
+ {
+ const auto fullPrefix = QStringLiteral(":/qt-project.org/styles/fusionstyle/images/") + prefix;
+ static constexpr auto dockTitleIconSizes = {10, 16, 20, 32, 48, 64};
+ for (int size : dockTitleIconSizes)
+ icon.addFile(fullPrefix + QString::number(size) + QStringLiteral(".png"),
+ QSize(size, size));
+ };
switch (standardIcon) {
case SP_TitleBarNormalButton:
- return QIcon(QPixmap(dock_widget_restore_xpm));
+ addIconFiles(u"fusion_normalizedockup-", icon);
+ break;
case SP_TitleBarMinButton:
- return QIcon(QPixmap(workspace_minimize));
+ addIconFiles(u"fusion_titlebar-min-", icon);
+ break;
case SP_TitleBarCloseButton:
case SP_DockWidgetCloseButton:
- return QIcon(QPixmap(dock_widget_close_xpm));
+ addIconFiles(u"fusion_closedock-", icon);
+ break;
default:
break;
}
-#endif // imageformat_xpm
+#else // imageformat_png
+ Q_UNUSED(standardIcon);
+#endif // imageformat_png
+ return icon;
+}
+
+/*!
+ \reimp
+*/
+QIcon QFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
+ const QWidget *widget) const
+{
+ const auto icon = iconFromTheme(standardIcon);
+ if (!icon.availableSizes().isEmpty())
+ return icon;
return QCommonStyle::standardIcon(standardIcon, option, widget);
}
@@ -3779,21 +3712,13 @@ QIcon QFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption
QPixmap QFusionStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
const QWidget *widget) const
{
-#ifndef QT_NO_IMAGEFORMAT_XPM
- switch (standardPixmap) {
- case SP_TitleBarNormalButton:
- return QPixmap(dock_widget_restore_xpm);
- case SP_TitleBarMinButton:
- return QPixmap(workspace_minimize);
- case SP_TitleBarCloseButton:
- case SP_DockWidgetCloseButton:
- return QPixmap(dock_widget_close_xpm);
-
- default:
- break;
- }
-#endif //QT_NO_IMAGEFORMAT_XPM
-
+ auto getDevicePixelRatio = [](const QWidget *widget)
+ {
+ return widget ? widget->devicePixelRatio() : qApp->devicePixelRatio();
+ };
+ const auto icon = iconFromTheme(standardPixmap);
+ if (!icon.availableSizes().isEmpty())
+ return icon.pixmap(QSize(16, 16), getDevicePixelRatio(widget));
return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
}
diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index cbefe3e1af..7dfeb34d7c 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFUSIONSTYLE_P_H
#define QFUSIONSTYLE_P_H
@@ -90,6 +54,7 @@ public:
int styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr,
QStyleHintReturn *returnData = nullptr) const override;
QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const override;
+ QIcon iconFromTheme(StandardPixmap standardIcon) const;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
const QWidget *widget = nullptr) const override;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h
index 75e0e2878e..da8e26ba04 100644
--- a/src/widgets/styles/qfusionstyle_p_p.h
+++ b/src/widgets/styles/qfusionstyle_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFUSIONSTYLE_P_P_H
#define QFUSIONSTYLE_P_P_H
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp
index 9213ff759e..8eadba9443 100644
--- a/src/widgets/styles/qpixmapstyle.cpp
+++ b/src/widgets/styles/qpixmapstyle.cpp
@@ -1,43 +1,7 @@
-/***************************************************************************
-**
-** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
-** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qpixmapstyle_p.h"
#include "qpixmapstyle_p_p.h"
@@ -1205,10 +1169,10 @@ QPixmap QPixmapStylePrivate::getCachedPixmap(QPixmapStyle::ControlDescriptor con
{
Q_Q(const QPixmapStyle);
- const QString sizeString = QString::number(size.width()) % QLatin1Char('*')
+ const QString sizeString = QString::number(size.width()) % u'*'
% QString::number(size.height());
- const QString key = QLatin1String(q->metaObject()->className()) % QString::number(control)
- % QLatin1Char('@') % sizeString;
+ const QString key = QLatin1StringView(q->metaObject()->className()) % QString::number(control)
+ % u'@' % sizeString;
QPixmap result;
@@ -1230,3 +1194,5 @@ QSize QPixmapStylePrivate::computeSize(const QPixmapStyleDescriptor &desc, int w
}
QT_END_NAMESPACE
+
+#include "moc_qpixmapstyle_p.cpp"
diff --git a/src/widgets/styles/qpixmapstyle_p.h b/src/widgets/styles/qpixmapstyle_p.h
index d32631a527..62233add74 100644
--- a/src/widgets/styles/qpixmapstyle_p.h
+++ b/src/widgets/styles/qpixmapstyle_p.h
@@ -1,43 +1,7 @@
-/***************************************************************************
-**
-** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
-** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2014 BlackBerry Limited. All rights reserved.
+// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXMAPSTYLE_H
#define QPIXMAPSTYLE_H
diff --git a/src/widgets/styles/qpixmapstyle_p_p.h b/src/widgets/styles/qpixmapstyle_p_p.h
index 481262d5c5..9e0495f788 100644
--- a/src/widgets/styles/qpixmapstyle_p_p.h
+++ b/src/widgets/styles/qpixmapstyle_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPIXMAPSTYLE_P_H
#define QPIXMAPSTYLE_P_H
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index 31fe587ce2..a85c40a329 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qstyle.h>
#include <private/qproxystyle_p.h>
@@ -48,6 +12,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
/*!
\class QProxyStyle
@@ -106,7 +72,7 @@ void QProxyStylePrivate::ensureBaseStyle() const
baseStyle = QStyleFactory::create(QApplicationPrivate::desktopStyleKey());
if (!baseStyle) // Fallback to windows style
- baseStyle = QStyleFactory::create(QLatin1String("windows"));
+ baseStyle = QStyleFactory::create("windows"_L1);
baseStyle->setProxy(const_cast<QProxyStyle*>(q));
baseStyle->setParent(const_cast<QProxyStyle*>(q)); // Take ownership
@@ -383,8 +349,18 @@ void QProxyStyle::unpolish(QApplication *app)
bool QProxyStyle::event(QEvent *e)
{
Q_D (QProxyStyle);
- d->ensureBaseStyle();
- return d->baseStyle->event(e);
+
+ switch (e->type()) {
+ // The Mac style relies on these events in order to set the focus frame
+ case QEvent::FocusIn:
+ case QEvent::FocusOut:
+ d->ensureBaseStyle();
+ return QApplication::sendEvent(d->baseStyle, e);
+ default:
+ break;
+ }
+
+ return QCommonStyle::event(e);
}
/*!
diff --git a/src/widgets/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h
index c26d9abf59..7b3ec9a939 100644
--- a/src/widgets/styles/qproxystyle.h
+++ b/src/widgets/styles/qproxystyle.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPROXYSTYLE_H
#define QPROXYSTYLE_H
diff --git a/src/widgets/styles/qproxystyle_p.h b/src/widgets/styles/qproxystyle_p.h
index 2321f0fed0..6b686023a5 100644
--- a/src/widgets/styles/qproxystyle_p.h
+++ b/src/widgets/styles/qproxystyle_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QPROXYSTYLE_P_H
#define QPROXYSTYLE_P_H
@@ -56,6 +20,8 @@
#include "qcommonstyle_p.h"
#include "qproxystyle.h"
+#include <QtCore/qpointer.h>
+
#ifndef QT_NO_STYLE_PROXY
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 9c4e66b0ba..60b2f51e95 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstyle.h"
#include "qapplication.h"
@@ -91,7 +55,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
look of the different platforms supported by Qt (QWindowsStyle,
QMacStyle, etc.). These styles are built into the
Qt GUI module, other styles can be made available using Qt's
- plugin mechansim.
+ plugin mechanism.
Most functions for drawing style elements take four arguments:
@@ -285,9 +249,6 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
widget is a QSpinBox just because the enum value is called
PE_IndicatorSpinUp or PE_IndicatorSpinDown.
- The documentation for the \l{widgets/styles}{Styles} example
- covers this topic in more detail.
-
\warning Qt style sheets are currently not supported for custom QStyle
subclasses. We plan to address this in some future release.
@@ -388,7 +349,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
The drawing of item view headers is also done by the style, giving
control over size of header items and row and column sizes.
- \sa QStyleOption, QStylePainter, {Styles Example},
+ \sa QStyleOption, QStylePainter,
{Styles and Style Aware Widgets}, QStyledItemDelegate, {Styling}
*/
@@ -412,6 +373,9 @@ QStyle::QStyle(QStylePrivate &dd)
{
Q_D(QStyle);
d->proxyStyle = this;
+ Q_STATIC_ASSERT_X(int(StandardPixmap::NStandardPixmap) ==
+ int(QPlatformTheme::StandardPixmap::NStandardPixmap),
+ "StandardPixmap in QPlatformTheme and QStyle out of sync");
}
/*!
@@ -573,8 +537,9 @@ QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pi
int x, y, w, h;
rect.getRect(&x, &y, &w, &h);
- const int pixmapWidth = pixmap.width()/pixmap.devicePixelRatio();
- const int pixmapHeight = pixmap.height()/pixmap.devicePixelRatio();
+ QSizeF pixmapSize = pixmap.deviceIndependentSize();
+ const int pixmapWidth = pixmapSize.width();
+ const int pixmapHeight = pixmapSize.height();
if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter)
y += h/2 - pixmapHeight/2;
@@ -718,7 +683,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PE_IndicatorToolBarSeparator The separator in a toolbar.
\value PE_PanelToolBar The panel for a toolbar.
\value PE_PanelTipLabel The panel for a tip label.
- \value PE_FrameTabBarBase The frame that is drawn for a tab bar, ususally drawn for a tab bar that isn't part of a tab widget.
+ \value PE_FrameTabBarBase The frame that is drawn for a tab bar, usually drawn for a tab bar that isn't part of a tab widget.
\value PE_IndicatorTabTear Deprecated. Use \l{PE_IndicatorTabTearLeft} instead.
\value PE_IndicatorTabTearLeft An indicator that a tab is partially scrolled out on the left side of the visible tab bar when there are many tabs.
\value PE_IndicatorTabTearRight An indicator that a tab is partially scrolled out on the right side of the visible tab bar when there are many tabs.
@@ -1503,21 +1468,19 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_SubMenuOverlap The horizontal overlap between a submenu and its parent.
- \value PM_TreeViewIndentation The indentation of items in a tree view.
- This enum value has been introduced in Qt 5.4.
+ \value [since 5.4] PM_TreeViewIndentation The indentation of items in a tree view.
\value PM_HeaderDefaultSectionSizeHorizontal The default size of sections
in a horizontal header. This enum value has been introduced in Qt 5.5.
\value PM_HeaderDefaultSectionSizeVertical The default size of sections
in a vertical header. This enum value has been introduced in Qt 5.5.
- \value PM_TitleBarButtonIconSize The size of button icons on a title bar.
- This enum value has been introduced in Qt 5.8.
- \value PM_TitleBarButtonSize The size of buttons on a title bar.
- This enum value has been introduced in Qt 5.8.
+ \value [since 5.8] PM_TitleBarButtonIconSize The size of button icons on a title bar.
+ \value [since 5.8] PM_TitleBarButtonSize The size of buttons on a title bar.
+
+ \value [since 6.2] PM_LineEditIconSize The default size for icons in a line edit.
- \value PM_LineEditIconSize The default size for icons in a line edit.
- This enum value has been introduced in Qt 6.2.
+ \value [since 6.3] PM_LineEditIconMargin The margin around icons in a line edit.
\value PM_CustomBase Base value for custom pixel metrics. Custom
values must be greater than this value.
@@ -1531,8 +1494,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
Returns the value of the given pixel \a metric.
The specified \a option and \a widget can be used for calculating
- the metric. In general, the \a widget argument is not used. The \a
- option can be cast to the appropriate type using the
+ the metric. The \a option can be cast to the appropriate type using the
qstyleoption_cast() function. Note that the \a option may be zero
even for PixelMetrics that can make use of it. See the table below
for the appropriate \a option casts:
@@ -1721,7 +1683,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
the line edit receives focus, as done on Windows.
\value SH_Menu_KeyboardSearch Typing causes a menu to be search
- for relevant items, otherwise only mnemnonic is considered.
+ for relevant items, otherwise only mnemonic is considered.
\value SH_Menu_AllowActiveAndDisabled Allows disabled menu
items to be active.
@@ -1799,7 +1761,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
cause a list view expansion to be selected.
\value SH_TabBar_PreferNoArrows Whether a tab bar should suggest a size
- to prevent scoll arrows.
+ to prevent scroll arrows.
\value SH_ComboBox_Popup Allows popups as a combobox drop-down
menu.
@@ -1849,6 +1811,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
spinbox mouse clicks.
\value SH_SpinBox_ClickAutoRepeatThreshold Auto-repeat threshold for
spinbox mouse clicks.
+ \value [since 6.3] SH_SpinBox_SelectOnStep Whether changing the value using
+ the buttons or up/down keys automatically selects the text.
+
\value SH_ToolTipLabel_Opacity An integer indicating the opacity for
the tip label, 0 is completely transparent, 255 is completely
opaque.
@@ -2013,6 +1978,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
of a QTabBar.
This enum value has been introduced in Qt 6.1.
+ \value SH_Table_AlwaysDrawLeftTopGridLines
+ Determines if the far left and top grid lines are drawn in a table or
+ not when the header is hidden. Defaults to false.
+ This enum value has been introduced in Qt 6.3.
+
\sa styleHint()
*/
@@ -2104,21 +2074,16 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SP_MediaSeekBackward Icon indicating that media should seek backward.
\value SP_MediaVolume Icon indicating a volume control.
\value SP_MediaVolumeMuted Icon indicating a muted volume control.
- \value SP_LineEditClearButton Icon for a standard clear button in a QLineEdit. This enum value was added in Qt 5.2.
- \value SP_DialogYesToAllButton Icon for a standard YesToAll button in a QDialogButtonBox.
- This enum value was added in Qt 5.14.
- \value SP_DialogNoToAllButton Icon for a standard NoToAll button in a QDialogButtonBox.
- This enum value was added in Qt 5.14.
- \value SP_DialogSaveAllButton Icon for a standard SaveAll button in a QDialogButtonBox.
- This enum value was added in Qt 5.14.
- \value SP_DialogAbortButton Icon for a standard Abort button in a QDialogButtonBox.
- This enum value was added in Qt 5.14.
- \value SP_DialogRetryButton Icon for a standard Retry button in a QDialogButtonBox.
- This enum value was added in Qt 5.14.
- \value SP_DialogIgnoreButton Icon for a standard Ignore button in a QDialogButtonBox.
- This enum value was added in Qt 5.14.
- \value SP_RestoreDefaultsButton Icon for a standard RestoreDefaults button in a QDialogButtonBox.
- This enum value was added in Qt 5.14.
+ \value [since 5.2] SP_LineEditClearButton Icon for a standard clear button in a QLineEdit.
+ \value [since 5.14] SP_DialogYesToAllButton Icon for a standard YesToAll button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogNoToAllButton Icon for a standard NoToAll button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogSaveAllButton Icon for a standard SaveAll button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogAbortButton Icon for a standard Abort button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogRetryButton Icon for a standard Retry button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogIgnoreButton Icon for a standard Ignore button in a QDialogButtonBox.
+ \value [since 5.14] SP_RestoreDefaultsButton Icon for a standard RestoreDefaults button in a QDialogButtonBox.
+ \value [since 6.3] SP_TabCloseButton Icon for the close button in the tab of a QTabBar.
+ \omitvalue NStandardPixmap
\value SP_CustomBase Base value for custom standard pixmaps;
custom values must be greater than this value.
@@ -2145,7 +2110,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
/*!
\fn QPixmap QStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option, const QWidget *widget) const
- \obsolete
+ \deprecated
Returns a pixmap for the given \a standardPixmap.
A standard pixmap is a pixmap that can follow some existing GUI
@@ -2256,13 +2221,15 @@ Qt::Alignment QStyle::visualAlignment(Qt::LayoutDirection direction, Qt::Alignme
int QStyle::sliderPositionFromValue(int min, int max, int logicalValue, int span, bool upsideDown)
{
- if (span <= 0 || logicalValue < min || max <= min)
+ if (span <= 0 || max <= min)
return 0;
+ if (logicalValue < min)
+ return upsideDown ? span : 0;
if (logicalValue > max)
- return upsideDown ? span : min;
+ return upsideDown ? 0 : span;
- uint range = max - min;
- uint p = upsideDown ? max - logicalValue : logicalValue - min;
+ const uint range = qint64(max) - min;
+ const uint p = upsideDown ? qint64(max) - logicalValue : qint64(logicalValue) - min;
if (range > (uint)INT_MAX/4096) {
double dpos = (double(p))/(double(range)/span);
@@ -2304,15 +2271,15 @@ int QStyle::sliderValueFromPosition(int min, int max, int pos, int span, bool up
if (pos >= span)
return upsideDown ? min : max;
- uint range = max - min;
+ const qint64 range = qint64(max) - min;
if ((uint)span > range) {
- int tmp = (2 * pos * range + span) / (2 * span);
+ const int tmp = (2 * range * pos + span) / (qint64(2) * span);
return upsideDown ? max - tmp : tmp + min;
} else {
- uint div = range / span;
- uint mod = range % span;
- int tmp = pos * div + (2 * pos * mod + span) / (2 * span);
+ const qint64 div = range / span;
+ const qint64 mod = range % span;
+ const int tmp = pos * div + (2 * mod * pos + span) / (qint64(2) * span);
return upsideDown ? max - tmp : tmp + min;
}
// equiv. to min + (pos*range)/span + 0.5
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index c3c99d9974..198aea9557 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLE_H
#define QSTYLE_H
@@ -500,11 +464,13 @@ public:
PM_ExclusiveIndicatorWidth,
PM_ExclusiveIndicatorHeight,
- PM_DialogButtonsSeparator,
- PM_DialogButtonsButtonWidth,
- PM_DialogButtonsButtonHeight,
+#if QT_DEPRECATED_SINCE(6, 8)
+ PM_DialogButtonsSeparator Q_DECL_ENUMERATOR_DEPRECATED_X("Not used and no effect since Qt 4"),
+ PM_DialogButtonsButtonWidth Q_DECL_ENUMERATOR_DEPRECATED_X("Not used and no effect since Qt 4"),
+ PM_DialogButtonsButtonHeight Q_DECL_ENUMERATOR_DEPRECATED_X("Not used and no effect since Qt 4"),
+#endif
- PM_MdiSubWindowFrameWidth,
+ PM_MdiSubWindowFrameWidth = 44,
PM_MdiSubWindowMinimizedWidth,
PM_HeaderMargin,
@@ -568,7 +534,7 @@ public:
PM_TitleBarButtonSize,
PM_LineEditIconSize,
-
+ PM_LineEditIconMargin,
// do not add any values below/greater than this
PM_CustomBase = 0xf0000000
};
@@ -736,6 +702,8 @@ public:
SH_SpinBox_ButtonsInsideFrame,
SH_SpinBox_StepModifier,
SH_TabBar_AllowWheelScrolling,
+ SH_Table_AlwaysDrawLeftTopGridLines,
+ SH_SpinBox_SelectOnStep,
// Add new style hint values here
SH_CustomBase = 0xf0000000
@@ -824,6 +792,8 @@ public:
SP_DialogRetryButton,
SP_DialogIgnoreButton,
SP_RestoreDefaultsButton,
+ SP_TabCloseButton,
+ NStandardPixmap, // assertion value for sync with QPlatformTheme::StandardPixmap
// do not add any values below/greater than this
SP_CustomBase = 0xf0000000
};
diff --git a/src/widgets/styles/qstyle.qrc b/src/widgets/styles/qstyle.qrc
deleted file mode 100644
index 44090a54f0..0000000000
--- a/src/widgets/styles/qstyle.qrc
+++ /dev/null
@@ -1,179 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/styles/commonstyle">
- <file>images/cleartext-16.png</file>
- <file>images/cleartext-32.png</file>
- <file>images/filelink-16.png</file>
- <file>images/filelink-32.png</file>
- <file>images/filelink-128.png</file>
- <file>images/file-16.png</file>
- <file>images/file-32.png</file>
- <file>images/file-128.png</file>
- <file>images/newdirectory-16.png</file>
- <file>images/newdirectory-32.png</file>
- <file>images/newdirectory-128.png</file>
- <file>images/parentdir-16.png</file>
- <file>images/parentdir-32.png</file>
- <file>images/parentdir-128.png</file>
- <file>images/dvd-16.png</file>
- <file>images/dvd-32.png</file>
- <file>images/dvd-128.png</file>
- <file>images/cdr-16.png</file>
- <file>images/cdr-32.png</file>
- <file>images/cdr-128.png</file>
- <file>images/floppy-16.png</file>
- <file>images/floppy-32.png</file>
- <file>images/floppy-128.png</file>
- <file>images/harddrive-16.png</file>
- <file>images/harddrive-32.png</file>
- <file>images/harddrive-128.png</file>
- <file>images/trash-16.png</file>
- <file>images/trash-32.png</file>
- <file>images/trash-128.png</file>
- <file>images/networkdrive-16.png</file>
- <file>images/networkdrive-32.png</file>
- <file>images/networkdrive-128.png</file>
- <file>images/computer-16.png</file>
- <file>images/computer-32.png</file>
- <file>images/desktop-16.png</file>
- <file>images/desktop-32.png</file>
- <file>images/dirclosed-16.png</file>
- <file>images/dirclosed-32.png</file>
- <file>images/dirclosed-128.png</file>
- <file>images/dirlink-16.png</file>
- <file>images/dirlink-32.png</file>
- <file>images/dirlink-128.png</file>
- <file>images/diropen-16.png</file>
- <file>images/diropen-32.png</file>
- <file>images/diropen-128.png</file>
- <file>images/left-16.png</file>
- <file>images/left-32.png</file>
- <file>images/left-128.png</file>
- <file>images/right-16.png</file>
- <file>images/right-32.png</file>
- <file>images/right-128.png</file>
- <file>images/up-16.png</file>
- <file>images/up-32.png</file>
- <file>images/up-128.png</file>
- <file>images/down-16.png</file>
- <file>images/down-32.png</file>
- <file>images/down-128.png</file>
- <file>images/filecontents-16.png</file>
- <file>images/filecontents-32.png</file>
- <file>images/filecontents-128.png</file>
- <file>images/fileinfo-16.png</file>
- <file>images/fileinfo-32.png</file>
- <file>images/fileinfo-128.png</file>
- <file>images/viewdetailed-16.png</file>
- <file>images/viewdetailed-32.png</file>
- <file>images/viewdetailed-128.png</file>
- <file>images/viewlist-16.png</file>
- <file>images/viewlist-32.png</file>
- <file>images/viewlist-128.png</file>
- <file>images/fontbitmap-16.png</file>
- <file>images/fonttruetype-16.png</file>
- <file>images/standardbutton-apply-128.png</file>
- <file>images/standardbutton-apply-16.png</file>
- <file>images/standardbutton-apply-32.png</file>
- <file>images/standardbutton-cancel-128.png</file>
- <file>images/standardbutton-cancel-16.png</file>
- <file>images/standardbutton-cancel-32.png</file>
- <file>images/standardbutton-clear-128.png</file>
- <file>images/standardbutton-clear-16.png</file>
- <file>images/standardbutton-clear-32.png</file>
- <file>images/standardbutton-close-128.png</file>
- <file>images/standardbutton-close-16.png</file>
- <file>images/standardbutton-close-32.png</file>
- <file>images/standardbutton-delete-128.png</file>
- <file>images/standardbutton-delete-16.png</file>
- <file>images/standardbutton-delete-32.png</file>
- <file>images/standardbutton-help-128.png</file>
- <file>images/standardbutton-help-16.png</file>
- <file>images/standardbutton-help-32.png</file>
- <file>images/standardbutton-no-128.png</file>
- <file>images/standardbutton-no-16.png</file>
- <file>images/standardbutton-no-32.png</file>
- <file>images/standardbutton-ok-128.png</file>
- <file>images/standardbutton-ok-16.png</file>
- <file>images/standardbutton-ok-32.png</file>
- <file>images/standardbutton-open-128.png</file>
- <file>images/standardbutton-open-16.png</file>
- <file>images/standardbutton-open-32.png</file>
- <file>images/standardbutton-save-128.png</file>
- <file>images/standardbutton-save-16.png</file>
- <file>images/standardbutton-save-32.png</file>
- <file>images/standardbutton-yes-128.png</file>
- <file>images/standardbutton-yes-16.png</file>
- <file>images/standardbutton-yes-32.png</file>
- <file>images/standardbutton-closetab-32.png</file>
- <file>images/standardbutton-closetab-16.png</file>
- <file>images/standardbutton-closetab-down-32.png</file>
- <file>images/standardbutton-closetab-down-16.png</file>
- <file>images/standardbutton-closetab-hover-32.png</file>
- <file>images/standardbutton-closetab-hover-16.png</file>
- <file>images/refresh-24.png</file>
- <file>images/refresh-32.png</file>
- <file>images/stop-24.png</file>
- <file>images/stop-32.png</file>
- <file>images/media-stop-16.png</file>
- <file>images/media-stop-32.png</file>
- <file>images/media-play-16.png</file>
- <file>images/media-play-32.png</file>
- <file>images/media-pause-16.png</file>
- <file>images/media-pause-32.png</file>
- <file>images/media-seek-forward-16.png</file>
- <file>images/media-seek-forward-32.png</file>
- <file>images/media-seek-backward-16.png</file>
- <file>images/media-seek-backward-32.png</file>
- <file>images/media-skip-forward-16.png</file>
- <file>images/media-skip-forward-32.png</file>
- <file>images/media-skip-backward-16.png</file>
- <file>images/media-skip-backward-32.png</file>
- <file>images/media-volume-16.png</file>
- <file>images/media-volume-muted-16.png</file>
- <file>images/fusion_groupbox.png</file>
- <file>images/closedock-10.png</file>
- <file>images/closedock-16.png</file>
- <file>images/closedock-20.png</file>
- <file>images/closedock-32.png</file>
- <file>images/closedock-48.png</file>
- <file>images/closedock-64.png</file>
- <file>images/normalizedockup-10.png</file>
- <file>images/normalizedockup-16.png</file>
- <file>images/normalizedockup-20.png</file>
- <file>images/normalizedockup-32.png</file>
- <file>images/normalizedockup-48.png</file>
- <file>images/normalizedockup-64.png</file>
- <file>images/toolbar-ext-h-8.png</file>
- <file>images/toolbar-ext-h-16.png</file>
- <file>images/toolbar-ext-h-32.png</file>
- <file>images/toolbar-ext-h-rtl-8.png</file>
- <file>images/toolbar-ext-h-rtl-16.png</file>
- <file>images/toolbar-ext-h-rtl-32.png</file>
- <file>images/toolbar-ext-v-5.png</file>
- <file>images/toolbar-ext-v-10.png</file>
- <file>images/toolbar-ext-v-20.png</file>
- <file>images/titlebar-contexthelp-16.png</file>
- <file>images/titlebar-contexthelp-32.png</file>
- <file>images/titlebar-contexthelp-48.png</file>
- <file>images/titlebar-max-16.png</file>
- <file>images/titlebar-max-32.png</file>
- <file>images/titlebar-max-48.png</file>
- <file>images/titlebar-min-16.png</file>
- <file>images/titlebar-min-32.png</file>
- <file>images/titlebar-min-48.png</file>
- <file>images/titlebar-shade-16.png</file>
- <file>images/titlebar-shade-32.png</file>
- <file>images/titlebar-shade-48.png</file>
- <file>images/titlebar-unshade-16.png</file>
- <file>images/titlebar-unshade-32.png</file>
- <file>images/titlebar-unshade-48.png</file>
- </qresource>
- <qresource prefix="/qt-project.org/styles/macstyle">
- <file alias="images/closedock-16.png">images/closedock-macstyle-16.png</file>
- <file alias="images/closedock-down-16.png">images/closedock-down-macstyle-16.png</file>
- <file alias="images/dockdock-16.png">images/dockdock-macstyle-16.png</file>
- <file alias="images/dockdock-down-16.png">images/dockdock-down-macstyle-16.png</file>
- <file alias="images/toolbar-ext.png">images/toolbar-ext-macstyle.png</file>
- <file alias="images/toolbar-ext@2x.png">images/toolbar-ext-macstyle@2x.png</file>
- </qresource>
-</RCC>
diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h
index ab451d4873..59e87810c5 100644
--- a/src/widgets/styles/qstyle_p.h
+++ b/src/widgets/styles/qstyle_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLE_P_H
#define QSTYLE_P_H
@@ -65,49 +29,36 @@ class QStylePrivate: public QObjectPrivate
{
Q_DECLARE_PUBLIC(QStyle)
public:
- inline QStylePrivate()
- : layoutSpacingIndex(-1), proxyStyle(nullptr) {}
-
static bool useFullScreenForPopup();
- mutable int layoutSpacingIndex;
QStyle *proxyStyle;
QString name;
};
-inline QImage styleCacheImage(const QSize &size)
-{
- const qreal pixelRatio = qApp->devicePixelRatio();
- QImage cacheImage = QImage(size * pixelRatio, QImage::Format_ARGB32_Premultiplied);
- cacheImage.setDevicePixelRatio(pixelRatio);
- return cacheImage;
-}
-
-inline QPixmap styleCachePixmap(const QSize &size)
+inline QPixmap styleCachePixmap(const QSize &size, qreal pixelRatio)
{
- const qreal pixelRatio = qApp->devicePixelRatio();
QPixmap cachePixmap = QPixmap(size * pixelRatio);
cachePixmap.setDevicePixelRatio(pixelRatio);
+ cachePixmap.fill(Qt::transparent);
return cachePixmap;
}
#define BEGIN_STYLE_PIXMAPCACHE(a) \
QRect rect = option->rect; \
QPixmap internalPixmapCache; \
- QImage imageCache; \
QPainter *p = painter; \
- QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \
+ const auto dpr = p->device()->devicePixelRatio(); \
+ const QString unique = QStyleHelper::uniqueName((a), option, option->rect.size(), dpr); \
int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
- bool doPixmapCache = (!option->rect.isEmpty()) \
+ const bool doPixmapCache = (!option->rect.isEmpty()) \
&& ((txType <= QTransform::TxTranslate) || (painter->deviceTransform().type() == QTransform::TxScale)); \
if (doPixmapCache && QPixmapCache::find(unique, &internalPixmapCache)) { \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
} else { \
if (doPixmapCache) { \
rect.setRect(0, 0, option->rect.width(), option->rect.height()); \
- imageCache = styleCacheImage(option->rect.size()); \
- imageCache.fill(0); \
- p = new QPainter(&imageCache); \
+ internalPixmapCache = styleCachePixmap(option->rect.size(), dpr); \
+ p = new QPainter(&internalPixmapCache); \
}
@@ -116,7 +67,6 @@ inline QPixmap styleCachePixmap(const QSize &size)
if (doPixmapCache) { \
p->end(); \
delete p; \
- internalPixmapCache = QPixmap::fromImage(imageCache); \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
QPixmapCache::insert(unique, internalPixmapCache); \
} \
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index d367bc491a..8e71bb4fae 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstyleanimation_p.h"
@@ -292,6 +256,7 @@ static QImage blendedImage(const QImage &start, const QImage &end, float alpha)
front_data += bpl;
}
}
+ break;
default:
break;
}
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index 0971289756..fc05607f96 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLEANIMATION_P_H
#define QSTYLEANIMATION_P_H
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index 70d08468ca..fc87b2b0c8 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstylefactory.h"
#include "qstyleplugin.h"
@@ -50,8 +14,10 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QStyleFactoryInterface_iid, QLatin1String("/styles"), Qt::CaseInsensitive))
+ (QStyleFactoryInterface_iid, "/styles"_L1, Qt::CaseInsensitive))
/*!
\class QStyleFactory
@@ -91,17 +57,17 @@ QStyle *QStyleFactory::create(const QString& key)
QStyle *ret = nullptr;
QString style = key.toLower();
#if QT_CONFIG(style_windows)
- if (style == QLatin1String("windows"))
+ if (style == "windows"_L1)
ret = new QWindowsStyle;
else
#endif
#if QT_CONFIG(style_fusion)
- if (style == QLatin1String("fusion"))
+ if (style == "fusion"_L1)
ret = new QFusionStyle;
else
#endif
#if defined(Q_OS_MACOS) && QT_DEPRECATED_SINCE(6, 0)
- if (style == QLatin1String("macintosh")) {
+ if (style == "macintosh"_L1) {
qWarning() << "The style key 'macintosh' is deprecated. Please use 'macos' instead.";
style = QStringLiteral("macos");
} else
@@ -132,12 +98,12 @@ QStringList QStyleFactory::keys()
for (PluginKeyMap::const_iterator it = keyMap.constBegin(); it != cend; ++it)
list.append(it.value());
#if QT_CONFIG(style_windows)
- if (!list.contains(QLatin1String("Windows")))
- list << QLatin1String("Windows");
+ if (!list.contains("Windows"_L1))
+ list << "Windows"_L1;
#endif
#if QT_CONFIG(style_fusion)
- if (!list.contains(QLatin1String("Fusion")))
- list << QLatin1String("Fusion");
+ if (!list.contains("Fusion"_L1))
+ list << "Fusion"_L1;
#endif
return list;
}
diff --git a/src/widgets/styles/qstylefactory.h b/src/widgets/styles/qstylefactory.h
index 50c3750b6c..ccaee95d44 100644
--- a/src/widgets/styles/qstylefactory.h
+++ b/src/widgets/styles/qstylefactory.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLEFACTORY_H
#define QSTYLEFACTORY_H
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 377df7705b..02827de847 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qstyleoption.h>
#include <qpainter.h>
@@ -61,21 +25,32 @@ Q_GUI_EXPORT int qt_defaultDpiX();
namespace QStyleHelper {
-QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
+static inline bool usePixmapCache(const QStyleOption *opt)
{
+ if (QWidget *widget = qobject_cast<QWidget *>(opt->styleObject))
+ return !widget->testAttribute(Qt::WA_StyleSheetTarget);
+ return true;
+}
+
+QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size, qreal dpr)
+{
+ if (!usePixmapCache(option))
+ return {};
+
const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
QString tmp = key % HexString<uint>(option->state)
% HexString<uint>(option->direction)
% HexString<uint>(complexOption ? uint(complexOption->activeSubControls) : 0u)
% HexString<quint64>(option->palette.cacheKey())
% HexString<uint>(size.width())
- % HexString<uint>(size.height());
+ % HexString<uint>(size.height())
+ % HexString<qreal>(dpr);
#if QT_CONFIG(spinbox)
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
tmp = tmp % HexString<uint>(spinBox->buttonSymbols)
% HexString<uint>(spinBox->stepEnabled)
- % QLatin1Char(spinBox->frame ? '1' : '0'); ;
+ % QChar(spinBox->frame ? u'1' : u'0');
}
#endif // QT_CONFIG(spinbox)
@@ -125,7 +100,7 @@ Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, const QStyleOption *option)
return dpiScaled(value, dpi(option));
}
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
bool isInstanceOf(QObject *obj, QAccessible::Role role)
{
bool match = false;
@@ -146,7 +121,7 @@ bool hasAncestor(QObject *obj, QAccessible::Role role)
}
return found;
}
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
#if QT_CONFIG(dial)
@@ -262,7 +237,7 @@ QPolygonF calcLines(const QStyleOptionSlider *dial)
void drawDial(const QStyleOptionSlider *option, QPainter *painter)
{
- QPalette pal = option->palette;
+ const QPalette pal = option->palette;
QColor buttonColor = pal.button().color();
const int width = option->rect.width();
const int height = option->rect.height();
@@ -276,7 +251,11 @@ void drawDial(const QStyleOptionSlider *option, QPainter *painter)
// Draw notches
if (option->subControls & QStyle::SC_DialTickmarks) {
- painter->setPen(option->palette.dark().color().darker(120));
+ const bool inverted = pal.window().color().lightness() < pal.text().color().lightness()
+ && pal.light().color().lightness() > pal.dark().color().lightness();
+ const QColor notchColor = inverted ? pal.light().color().lighter(120)
+ : pal.dark().color().darker(120);
+ painter->setPen(notchColor);
painter->drawLines(QStyleHelper::calcLines(option));
}
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index 165608257a..98470ad1ce 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include <QtCore/qpoint.h>
@@ -75,7 +39,7 @@ class QWindow;
namespace QStyleHelper
{
- QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size);
+ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size, qreal dpr);
Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option);
@@ -92,7 +56,7 @@ namespace QStyleHelper
Q_WIDGETS_EXPORT void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
int left = 0, int top = 0, int right = 0,
int bottom = 0);
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
Q_WIDGETS_EXPORT bool isInstanceOf(QObject *obj, QAccessible::Role role);
Q_WIDGETS_EXPORT bool hasAncestor(QObject *obj, QAccessible::Role role);
#endif
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index fba7bd071d..d3a395246c 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qstylehelper_p.h"
@@ -86,9 +50,6 @@ QT_BEGIN_NAMESPACE
The qstyleoption_cast() function will return 0 if the object to
which \c option points is not of the correct type.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyle, QStylePainter
*/
@@ -365,9 +326,6 @@ QStyleOption &QStyleOption::operator=(const QStyleOption &other)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -464,9 +422,6 @@ QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
without breaking compatibility. If you use qstyleoption_cast(),
you normally do not need to check it.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -591,9 +546,6 @@ QStyleOptionFrame::QStyleOptionFrame(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QStyleOptionComplex, QGroupBox
*/
@@ -724,9 +676,6 @@ QStyleOptionGroupBox::QStyleOptionGroupBox(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -951,9 +900,6 @@ QStyleOptionHeaderV2::QStyleOptionHeaderV2(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QStyleOptionToolButton
*/
@@ -1090,9 +1036,6 @@ QStyleOptionButton::QStyleOptionButton(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -1274,9 +1217,6 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -1350,6 +1290,7 @@ QStyleOptionTab::QStyleOptionTab(int version)
\value Middle The tab is neither the first nor the last tab in the tab bar.
\value End The tab is the last tab in the tab bar.
\value OnlyOneTab The tab is both the first and the last tab in the tab bar.
+ \value [since 6.6] Moving The tab is moving by mouse drag or animation.
\sa position
*/
@@ -1401,7 +1342,7 @@ QStyleOptionTab::QStyleOptionTab(int version)
/*!
\variable QStyleOptionTab::shape
\brief the tab shape used to draw the tab; by default
- QTabBar::RoundedNorth
+ QTabBar::RoundedNorth.
\sa QTabBar::Shape
*/
@@ -1511,9 +1452,6 @@ QStyleOptionTab::QStyleOptionTab(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -1535,6 +1473,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
invertedAppearance(false), bottomToTop(false)
{
+ state |= QStyle::State_Horizontal;
}
/*!
@@ -1618,7 +1557,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
/*!
\variable QStyleOptionProgressBar::textAlignment
- \brief the text alignment for the text in the QProgressBar
+ \brief the text alignment for the text in the QProgressBar.
This can be used as a guide on where the text should be in the
progress bar. The default value is Qt::AlignLeft.
@@ -1671,9 +1610,6 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -1874,9 +1810,6 @@ QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -1967,9 +1900,6 @@ QStyleOptionComplex::QStyleOptionComplex(int version, int type)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOptionComplex, QSlider, QScrollBar
*/
@@ -2164,9 +2094,6 @@ QStyleOptionSlider::QStyleOptionSlider(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QStyleOptionComplex
*/
@@ -2269,9 +2196,6 @@ QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption
*/
@@ -2375,9 +2299,6 @@ QStyleOptionDockWidget::QStyleOptionDockWidget(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QStyleOptionComplex, QStyleOptionButton
*/
@@ -2539,9 +2460,6 @@ QStyleOptionToolButton::QStyleOptionToolButton(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QStyleOptionComplex, QComboBox
*/
@@ -2675,9 +2593,6 @@ QStyleOptionComboBox::QStyleOptionComboBox(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QToolBox
*/
@@ -2802,9 +2717,6 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QRubberBand
*/
@@ -2894,9 +2806,6 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QStyleOptionComplex, QMdiSubWindow
*/
@@ -3007,9 +2916,6 @@ QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, {model-view-programming.html}{Model/View
Programming}
*/
@@ -3270,9 +3176,6 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QTabWidget
*/
@@ -3412,15 +3315,12 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QTabBar::drawBase()
*/
/*!
Construct a QStyleOptionTabBarBase, initializing the members
- vaiables to their default values.
+ variables to their default values.
*/
QStyleOptionTabBarBase::QStyleOptionTabBarBase()
: QStyleOptionTabBarBase(Version)
@@ -3522,9 +3422,6 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QStyleOptionComplex, QSizeGrip
*/
@@ -3602,9 +3499,6 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
and emphasizes that these are simply parameters used by the style
functions.
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
\sa QStyleOption, QGraphicsItem::paint()
*/
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 0f41211521..0e0118f6e9 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLEOPTION_H
#define QSTYLEOPTION_H
@@ -229,6 +193,7 @@ protected:
QStyleOptionHeader(int version);
};
+// ### Qt7: merge with QStyleOptionHeader
class Q_WIDGETS_EXPORT QStyleOptionHeaderV2 : public QStyleOptionHeader
{
public:
@@ -279,7 +244,7 @@ public:
enum StyleOptionType { Type = SO_Tab };
enum StyleOptionVersion { Version = 1 };
- enum TabPosition { Beginning, Middle, End, OnlyOneTab };
+ enum TabPosition { Beginning, Middle, End, OnlyOneTab, Moving };
enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
enum CornerWidget { NoCornerWidgets = 0x00, LeftCornerWidget = 0x01,
RightCornerWidget = 0x02 };
diff --git a/src/widgets/styles/qstylepainter.cpp b/src/widgets/styles/qstylepainter.cpp
index 66cf494519..375928ae4b 100644
--- a/src/widgets/styles/qstylepainter.cpp
+++ b/src/widgets/styles/qstylepainter.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstylepainter.h"
diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h
index b5e7956cb1..240ffbd137 100644
--- a/src/widgets/styles/qstylepainter.h
+++ b/src/widgets/styles/qstylepainter.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLEPAINTER_H
#define QSTYLEPAINTER_H
@@ -59,8 +23,10 @@ public:
Q_ASSERT_X(w, "QStylePainter::QStylePainter", "Widget must be non-zero");
widget = w;
wstyle = w->style();
- return QPainter::begin(pd);
- };
+ const bool res = QPainter::begin(pd);
+ setRenderHint(QPainter::SmoothPixmapTransform);
+ return res;
+ }
inline void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption &opt);
inline void drawControl(QStyle::ControlElement ce, const QStyleOption &opt);
inline void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex &opt);
diff --git a/src/widgets/styles/qstyleplugin.cpp b/src/widgets/styles/qstyleplugin.cpp
index b29ff0b9a1..94ea92e0a3 100644
--- a/src/widgets/styles/qstyleplugin.cpp
+++ b/src/widgets/styles/qstyleplugin.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstyleplugin.h"
#include "qstyle.h"
diff --git a/src/widgets/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h
index e9a26f9127..3a24f9e387 100644
--- a/src/widgets/styles/qstyleplugin.h
+++ b/src/widgets/styles/qstyleplugin.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLEPLUGIN_H
#define QSTYLEPLUGIN_H
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index fb07cf4d20..655b224617 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qglobal.h>
#include "qstylesheetstyle_p.h"
@@ -95,7 +59,7 @@
#include <private/qstyleanimation_p.h>
#endif
#if QT_CONFIG(tabbar)
-#include <qtabbar.h>
+#include <private/qtabbar_p.h>
#endif
#include <QMetaProperty>
#if QT_CONFIG(mainwindow)
@@ -123,6 +87,9 @@
#if QT_CONFIG(toolbar)
#include <QtWidgets/qtoolbar.h>
#endif
+#if QT_CONFIG(pushbutton)
+#include <QtWidgets/qpushbutton.h>
+#endif
#include <QtGui/qpainterpath.h>
#include <QtGui/qscreen.h>
@@ -131,6 +98,8 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
using namespace QCss;
@@ -148,7 +117,7 @@ static QStyleSheetStyleCaches *styleSheetCaches = nullptr;
* the QStyleSheetStyle is a proxy. If used with others proxy style, we may end up with something like:
* QStyleSheetStyle -> ProxyStyle -> QStyleSheetStyle -> OriginalStyle
* Recursion may happen if the style call the widget()->style() again.
- * Not to mention the performence penalty of having two lookup of rules.
+ * Not to mention the performance penalty of having two lookup of rules.
*
* The first instance of QStyleSheetStyle will set globalStyleSheetStyle to itself. The second one
* will notice the globalStyleSheetStyle is not istelf and call its base style directly.
@@ -169,8 +138,6 @@ class QStyleSheetStyleRecursionGuard
if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { RETURN; } \
QStyleSheetStyleRecursionGuard recursion_guard(this);
-#define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x)))
-
enum PseudoElement {
PseudoElement_None,
PseudoElement_DownArrow,
@@ -191,7 +158,7 @@ enum PseudoElement {
PseudoElement_GroupBoxIndicator,
PseudoElement_ToolButtonMenu,
PseudoElement_ToolButtonMenuArrow,
- PseudoElement_ToolButtonDownArrow,
+ PseudoElement_ToolButtonMenuIndicator,
PseudoElement_ToolBoxTab,
PseudoElement_ScrollBarSlider,
PseudoElement_ScrollBarAddPage,
@@ -467,15 +434,26 @@ struct QStyleSheetBoxData : public QSharedData
struct QStyleSheetPaletteData : public QSharedData
{
- QStyleSheetPaletteData(const QBrush &fg, const QBrush &sfg, const QBrush &sbg,
- const QBrush &abg)
- : foreground(fg), selectionForeground(sfg), selectionBackground(sbg),
- alternateBackground(abg) { }
+ QStyleSheetPaletteData(const QBrush &foreground,
+ const QBrush &selectedForeground,
+ const QBrush &selectedBackground,
+ const QBrush &alternateBackground,
+ const QBrush &placeHolderTextForeground,
+ const QBrush &accent)
+ : foreground(foreground)
+ , selectionForeground(selectedForeground)
+ , selectionBackground(selectedBackground)
+ , alternateBackground(alternateBackground)
+ , placeholderForeground(placeHolderTextForeground)
+ , accent(accent)
+ { }
QBrush foreground;
QBrush selectionForeground;
QBrush selectionBackground;
QBrush alternateBackground;
+ QBrush placeholderForeground;
+ QBrush accent;
};
struct QStyleSheetGeometryData : public QSharedData
@@ -647,7 +625,7 @@ public:
Q_DECLARE_TYPEINFO(QRenderRule, Q_RELOCATABLE_TYPE);
///////////////////////////////////////////////////////////////////////////////////////////
-static const char knownStyleHints[][45] = {
+static constexpr std::array<const char*, 90> knownStyleHints = {
"activate-on-singleclick",
"alignment",
"arrow-keys-navigate-into-children",
@@ -740,13 +718,10 @@ static const char knownStyleHints[][45] = {
"widget-animation-duration"
};
-static const int numKnownStyleHints = sizeof(knownStyleHints)/sizeof(knownStyleHints[0]);
-
-static QList<QVariant> subControlLayout(const QString& layout)
+static QList<QVariant> subControlLayout(QByteArrayView layout)
{
QList<QVariant> buttons;
- for (int i = 0; i < layout.count(); i++) {
- int button = layout[i].toLatin1();
+ for (int button : layout) {
switch (button) {
case 'm':
buttons.append(PseudoElement_MdiMinButton);
@@ -801,17 +776,16 @@ QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget
const bool isMaximized = tb->titleBarState & Qt::WindowMaximized;
QRenderRule subRule = renderRule(w, tb);
QRect cr = subRule.contentsRect(tb->rect);
- QList<QVariant> layout = subRule.styleHint(QLatin1String("button-layout")).toList();
+ QList<QVariant> layout = subRule.styleHint("button-layout"_L1).toList();
if (layout.isEmpty())
- layout = subControlLayout(QLatin1String("I(T)HSmMX"));
+ layout = subControlLayout("I(T)HSmMX"_L1);
int offsets[3] = { 0, 0, 0 };
enum Where { Left, Right, Center, NoWhere } where = Left;
QList<ButtonInfo> infos;
- const int numLayouts = layout.size();
- infos.reserve(numLayouts);
- for (int i = 0; i < numLayouts; i++) {
- const int element = layout[i].toInt();
+ infos.reserve(layout.size());
+ for (const QVariant &val : std::as_const(layout)) {
+ const int element = val.toInt();
if (element == '(') {
where = Center;
} else if (element == ')') {
@@ -870,8 +844,7 @@ QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget
}
}
- for (int i = 0; i < infos.size(); i++) {
- const ButtonInfo &info = infos[i];
+ for (const ButtonInfo &info : std::as_const(infos)) {
QRect lr = cr;
switch (info.where) {
case Center: {
@@ -987,10 +960,17 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
bg = new QStyleSheetBackgroundData(brush, pixmap, repeat, alignment, origin, attachment, clip);
}
- QBrush sfg, fg;
- QBrush sbg, abg;
- if (v.extractPalette(&fg, &sfg, &sbg, &abg))
- pal = new QStyleSheetPaletteData(fg, sfg, sbg, abg);
+ QBrush foreground;
+ QBrush selectedForeground;
+ QBrush selectedBackground;
+ QBrush alternateBackground;
+ QBrush placeHolderTextForeground;
+ QBrush accent;
+ if (v.extractPalette(&foreground, &selectedForeground, &selectedBackground,
+ &alternateBackground, &placeHolderTextForeground, &accent)) {
+ pal = new QStyleSheetPaletteData(foreground, selectedForeground, selectedBackground,
+ alternateBackground, placeHolderTextForeground, accent);
+ }
QIcon imgIcon;
alignment = Qt::AlignCenter;
@@ -1011,7 +991,7 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
palette = QToolTip::palette();
#endif
- for (int i = 0; i < declarations.count(); i++) {
+ for (int i = 0; i < declarations.size(); i++) {
const Declaration& decl = declarations.at(i);
if (decl.d->propertyId == BorderImage) {
QString uri;
@@ -1019,7 +999,7 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
int cuts[4];
decl.borderImageValue(&uri, cuts, &horizStretch, &vertStretch);
- if (uri.isEmpty() || uri == QLatin1String("none")) {
+ if (uri.isEmpty() || uri == "none"_L1) {
if (bd && bd->bi)
bd->bi->pixmap = QPixmap();
} else {
@@ -1041,38 +1021,66 @@ QRenderRule::QRenderRule(const QList<Declaration> &declarations, const QObject *
int role = decl.d->values.at(0).variant.toInt();
if (role >= Value_FirstColorRole && role <= Value_LastColorRole)
defaultBackground = palette.color((QPalette::ColorRole)(role-Value_FirstColorRole));
- } else if (decl.d->property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive)) {
+ } else if (decl.d->property.startsWith("qproperty-"_L1, Qt::CaseInsensitive)) {
// intentionally left blank...
} else if (decl.d->propertyId == UnknownProperty) {
bool knownStyleHint = false;
- for (int i = 0; i < numKnownStyleHints; i++) {
- QLatin1String styleHint(knownStyleHints[i]);
+ for (const auto sh : knownStyleHints) {
+ QLatin1StringView styleHint(sh);
if (decl.d->property.compare(styleHint) == 0) {
- QString hintName = QString(styleHint);
- QVariant hintValue;
- if (hintName.endsWith(QLatin1String("alignment"))) {
- hintValue = (int) decl.alignmentValue();
- } else if (hintName.endsWith(QLatin1String("color"))) {
- hintValue = (int) decl.colorValue().rgba();
- } else if (hintName.endsWith(QLatin1String("size"))) {
- hintValue = decl.sizeValue();
- } else if (hintName.endsWith(QLatin1String("icon"))) {
- hintValue = decl.iconValue();
- } else if (hintName == QLatin1String("button-layout")
- && decl.d->values.count() != 0 && decl.d->values.at(0).type == Value::String) {
- hintValue = subControlLayout(decl.d->values.at(0).variant.toString());
- } else {
- int integer;
- decl.intValue(&integer);
- hintValue = integer;
- }
- styleHints[decl.d->property] = hintValue;
- knownStyleHint = true;
- break;
+ QString hintName = QString(styleHint);
+ QVariant hintValue;
+ if (hintName.endsWith("alignment"_L1)) {
+ hintValue = (int) decl.alignmentValue();
+ } else if (hintName.endsWith("color"_L1)) {
+ hintValue = (int) decl.colorValue().rgba();
+ } else if (hintName.endsWith("size"_L1)) {
+ // Check only for the 'em' case
+ const QString valueString = decl.d->values.at(0).variant.toString();
+ const bool isEmSize = valueString.endsWith(u"em", Qt::CaseInsensitive);
+ if (isEmSize || valueString.endsWith(u"ex", Qt::CaseInsensitive)) {
+ // 1em == size of font; 1ex == xHeight of font
+ // See lengthValueFromData helper in qcssparser.cpp
+ QFont fontForSize(font);
+ // if no font is specified, then use the widget font if possible
+ if (const QWidget *widget; !hasFont && (widget = qobject_cast<const QWidget*>(object)))
+ fontForSize = widget->font();
+
+ const QFontMetrics fontMetrics(fontForSize);
+ qreal pixelSize = isEmSize ? fontMetrics.height() : fontMetrics.xHeight();
+
+ // Transform size according to the 'em'/'ex' value
+ qreal emexSize = {};
+ if (decl.realValue(&emexSize, isEmSize ? "em" : "ex") && emexSize > 0) {
+ pixelSize *= emexSize;
+ const QSizeF newSize(pixelSize, pixelSize);
+ decl.d->parsed = QVariant::fromValue<QSizeF>(newSize);
+ hintValue = newSize;
+ } else {
+ qWarning("Invalid '%s' size for %s. Skipping.",
+ isEmSize ? "em" : "ex", qPrintable(valueString));
+ }
+ } else {
+ // Normal case where we receive a 'px' or 'pt' unit
+ hintValue = decl.sizeValue();
+ }
+ } else if (hintName.endsWith("icon"_L1)) {
+ hintValue = decl.iconValue();
+ } else if (hintName == "button-layout"_L1 && decl.d->values.size() != 0
+ && decl.d->values.at(0).type == QCss::Value::String) {
+ hintValue = subControlLayout(decl.d->values.at(0).variant.toString().toLatin1());
+ } else {
+ int integer;
+ decl.intValue(&integer);
+ hintValue = integer;
+ }
+ styleHints[decl.d->property] = hintValue;
+ knownStyleHint = true;
+ break;
}
}
if (!knownStyleHint)
- qDebug("Unknown property %s", qPrintable(decl.d->property));
+ qWarning("Unknown property %s", qPrintable(decl.d->property));
}
}
@@ -1387,7 +1395,7 @@ void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& o
// ### fix for gradients
const QPainterPath &borderPath = borderClip(originRect(rect, origin));
if (!borderPath.isEmpty()) {
- // Drawn intead of being used as clipping path for better visual quality
+ // Drawn instead of being used as clipping path for better visual quality
bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;
p->setRenderHint(QPainter::Antialiasing);
p->fillPath(borderPath, brush);
@@ -1452,6 +1460,16 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette
p->setBrush(QPalette::AlternateBase, pal->alternateBackground);
}
+void setDefault(QPalette *palette, QPalette::ColorGroup group, QPalette::ColorRole role,
+ const QBrush &defaultBrush, const QWidget *widget)
+{
+ const QPalette &widgetPalette = widget->palette();
+ if (widgetPalette.isBrushSet(group, role))
+ palette->setBrush(group, role, widgetPalette.brush(group, role));
+ else
+ palette->setBrush(group, role, defaultBrush);
+}
+
void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const QWidget *w, bool embedded)
{
if (bg && bg->brush.style() != Qt::NoBrush) {
@@ -1473,11 +1491,15 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q
return;
if (pal->foreground.style() != Qt::NoBrush) {
- p->setBrush(cg, QPalette::ButtonText, pal->foreground);
- p->setBrush(cg, w->foregroundRole(), pal->foreground);
- p->setBrush(cg, QPalette::WindowText, pal->foreground);
- p->setBrush(cg, QPalette::Text, pal->foreground);
- p->setBrush(cg, QPalette::PlaceholderText, pal->foreground);
+ setDefault(p, cg, QPalette::ButtonText, pal->foreground, w);
+ setDefault(p, cg, w->foregroundRole(), pal->foreground, w);
+ setDefault(p, cg, QPalette::WindowText, pal->foreground, w);
+ setDefault(p, cg, QPalette::Text, pal->foreground, w);
+ QColor phColor(pal->foreground.color());
+ phColor.setAlpha((phColor.alpha() + 1) / 2);
+ QBrush placeholder = pal->foreground;
+ placeholder.setColor(phColor);
+ setDefault(p, cg, QPalette::PlaceholderText, placeholder, w);
}
if (pal->selectionBackground.style() != Qt::NoBrush)
p->setBrush(cg, QPalette::Highlight, pal->selectionBackground);
@@ -1485,6 +1507,10 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q
p->setBrush(cg, QPalette::HighlightedText, pal->selectionForeground);
if (pal->alternateBackground.style() != Qt::NoBrush)
p->setBrush(cg, QPalette::AlternateBase, pal->alternateBackground);
+ if (pal->placeholderForeground.style() != Qt::NoBrush)
+ p->setBrush(cg, QPalette::PlaceholderText, pal->placeholderForeground);
+ if (pal->accent.style() != Qt::NoBrush)
+ p->setBrush(cg, QPalette::Accent, pal->accent);
}
bool QRenderRule::hasModification() const
@@ -1530,48 +1556,62 @@ public:
const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject();
#if QT_CONFIG(tooltip)
if (qstrcmp(metaObject->className(), "QTipLabel") == 0)
- return QStringList(QLatin1String("QToolTip"));
+ return QStringList("QToolTip"_L1);
#endif
QStringList result;
do {
- result += QString::fromLatin1(metaObject->className()).replace(QLatin1Char(':'), QLatin1Char('-'));
+ result += QString::fromLatin1(metaObject->className()).replace(u':', u'-');
metaObject = metaObject->superClass();
} while (metaObject != nullptr);
return result;
}
- QString attribute(NodePtr node, const QString& name) const override
+ QString attributeValue(NodePtr node, const QCss::AttributeSelector& aSelector) const override
{
if (isNullNode(node))
return QString();
+ const QString &name = aSelector.name;
QHash<QString, QString> &cache = m_attributeCache[OBJECT_PTR(node)];
QHash<QString, QString>::const_iterator cacheIt = cache.constFind(name);
if (cacheIt != cache.constEnd())
return cacheIt.value();
+ QVariant value;
+ QString valueStr;
QObject *obj = OBJECT_PTR(node);
- QVariant value = obj->property(name.toLatin1());
- if (!value.isValid()) {
- if (name == QLatin1String("class")) {
- QString className = QString::fromLatin1(obj->metaObject()->className());
- if (className.contains(QLatin1Char(':')))
- className.replace(QLatin1Char(':'), QLatin1Char('-'));
- cache[name] = className;
- return className;
- } else if (name == QLatin1String("style")) {
- QWidget *w = qobject_cast<QWidget *>(obj);
- QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : nullptr;
- if (proxy) {
- QString styleName = QString::fromLatin1(proxy->baseStyle()->metaObject()->className());
- cache[name] = styleName;
- return styleName;
+ const int propertyIndex = obj->metaObject()->indexOfProperty(name.toLatin1());
+ if (propertyIndex == -1) {
+ value = obj->property(name.toLatin1()); // might be a dynamic property
+ if (!value.isValid()) {
+ if (name == "class"_L1) {
+ QString className = QString::fromLatin1(obj->metaObject()->className());
+ if (className.contains(u':'))
+ className.replace(u':', u'-');
+ valueStr = className;
+ } else if (name == "style"_L1) {
+ QWidget *w = qobject_cast<QWidget *>(obj);
+ QStyleSheetStyle *proxy = w ? qt_styleSheet(w->style()) : nullptr;
+ if (proxy)
+ valueStr = QString::fromLatin1(proxy->baseStyle()->metaObject()->className());
}
}
+ } else {
+ const QMetaProperty property = obj->metaObject()->property(propertyIndex);
+ value = property.read(obj);
+ // support Qt 5 selector syntax, which required the integer enum value
+ if (property.isEnumType()) {
+ bool isNumber;
+ aSelector.value.toInt(&isNumber);
+ if (isNumber)
+ value.convert(QMetaType::fromType<int>());
+ }
+ }
+ if (value.isValid()) {
+ valueStr = (value.userType() == QMetaType::QStringList
+ || value.userType() == QMetaType::QVariantList)
+ ? value.toStringList().join(u' ')
+ : value.toString();
}
- QString valueStr = (value.userType() == QMetaType::QStringList
- || value.userType() == QMetaType::QVariantList)
- ? value.toStringList().join(QLatin1Char(' '))
- : value.toString();
cache[name] = valueStr;
return valueStr;
}
@@ -1582,11 +1622,11 @@ public:
const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject();
#if QT_CONFIG(tooltip)
if (qstrcmp(metaObject->className(), "QTipLabel") == 0)
- return nodeName == QLatin1String("QToolTip");
+ return nodeName == "QToolTip"_L1;
#endif
do {
- const ushort *uc = (const ushort *)nodeName.constData();
- const ushort *e = uc + nodeName.length();
+ const auto *uc = reinterpret_cast<const char16_t *>(nodeName.constData());
+ const auto *e = uc + nodeName.size();
const uchar *c = (const uchar *)metaObject->className();
while (*c && uc != e && (*uc == *c || (*c == ':' && *uc == '-'))) {
++uc;
@@ -1636,7 +1676,8 @@ QList<QCss::StyleRule> QStyleSheetStyle::styleRules(const QObject *obj) const
defaultSs = getDefaultStyleSheet();
QStyle *bs = baseStyle();
styleSheetCaches->styleSheetCache.insert(bs, defaultSs);
- QObject::connect(bs, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection);
+ QObject::connect(bs, &QStyle::destroyed, styleSheetCaches,
+ &QStyleSheetStyleCaches::styleDestroyed);
} else {
defaultSs = defaultCacheIt.value();
}
@@ -1647,7 +1688,7 @@ QList<QCss::StyleRule> QStyleSheetStyle::styleRules(const QObject *obj) const
QHash<const void *, StyleSheet>::const_iterator appCacheIt = styleSheetCaches->styleSheetCache.constFind(qApp);
if (appCacheIt == styleSheetCaches->styleSheetCache.constEnd()) {
QString ss = qApp->styleSheet();
- if (ss.startsWith(QLatin1String("file:///")))
+ if (ss.startsWith("file:///"_L1))
ss.remove(0, 8);
parser.init(ss, qApp->styleSheet() != ss);
if (Q_UNLIKELY(!parser.parse(&appSs)))
@@ -1671,7 +1712,7 @@ QList<QCss::StyleRule> QStyleSheetStyle::styleRules(const QObject *obj) const
if (objCacheIt == styleSheetCaches->styleSheetCache.constEnd()) {
parser.init(styleSheet);
if (!parser.parse(&ss)) {
- parser.init(QLatin1String("* {") + styleSheet + QLatin1Char('}'));
+ parser.init("* {"_L1 + styleSheet + u'}');
if (Q_UNLIKELY(!parser.parse(&ss)))
qWarning() << "Could not parse stylesheet of object" << o;
}
@@ -1683,8 +1724,8 @@ QList<QCss::StyleRule> QStyleSheetStyle::styleRules(const QObject *obj) const
objectSs.append(ss);
}
- for (int i = 0; i < objectSs.count(); i++)
- objectSs[i].depth = objectSs.count() - i + 2;
+ for (int i = 0; i < objectSs.size(); i++)
+ objectSs[i].depth = objectSs.size() - i + 2;
styleSelector.styleSheets += objectSs;
@@ -1701,7 +1742,7 @@ static QList<Declaration> declarations(const QList<StyleRule> &styleRules, const
quint64 pseudoClass = PseudoClass_Unspecified)
{
QList<Declaration> decls;
- for (int i = 0; i < styleRules.count(); i++) {
+ for (int i = 0; i < styleRules.size(); i++) {
const Selector& selector = styleRules.at(i).selectors.at(0);
// Rules with pseudo elements don't cascade. This is an intentional
// diversion for CSS
@@ -1808,9 +1849,9 @@ static void qt_check_if_internal_object(const QObject **obj, int *element)
Q_UNUSED(element);
#else
if (*obj && qstrcmp((*obj)->metaObject()->className(), "QDockWidgetTitleButton") == 0) {
- if ((*obj)->objectName() == QLatin1String("qt_dockwidget_closebutton")) {
+ if ((*obj)->objectName() == "qt_dockwidget_closebutton"_L1) {
*element = PseudoElement_DockWidgetCloseButton;
- } else if ((*obj)->objectName() == QLatin1String("qt_dockwidget_floatbutton")) {
+ } else if ((*obj)->objectName() == "qt_dockwidget_floatbutton"_L1) {
*element = PseudoElement_DockWidgetFloatButton;
}
*obj = (*obj)->parent();
@@ -1831,7 +1872,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, int element, quint6
quint64 stateMask = 0;
const QList<StyleRule> rules = styleRules(obj);
- for (int i = 0; i < rules.count(); i++) {
+ for (int i = 0; i < rules.size(); i++) {
const Selector& selector = rules.at(i).selectors.at(0);
quint64 negated = 0;
stateMask |= selector.pseudoClass(&negated);
@@ -1846,7 +1887,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, int element, quint6
}
- const QString part = QLatin1String(knownPseudoElements[element].name);
+ const QString part = QLatin1StringView(knownPseudoElements[element].name);
QList<Declaration> decls = declarations(rules, part, state);
QRenderRule newRule(decls, obj);
cache[state] = newRule;
@@ -1896,7 +1937,7 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption
break;
case PseudoElement_ToolButtonMenu:
case PseudoElement_ToolButtonMenuArrow:
- case PseudoElement_ToolButtonDownArrow:
+ case PseudoElement_ToolButtonMenuIndicator:
state |= complex->state & QStyle::State_MouseOver;
if (complex->state & QStyle::State_Sunken ||
complex->activeSubControls & QStyle::SC_ToolButtonMenu)
@@ -2152,8 +2193,8 @@ bool QStyleSheetStyle::hasStyleRule(const QObject *obj, int part) const
return result;
}
- QString pseudoElement = QLatin1String(knownPseudoElements[part].name);
- for (int i = 0; i < rules.count(); i++) {
+ auto pseudoElement = QLatin1StringView(knownPseudoElements[part].name);
+ for (int i = 0; i < rules.size(); i++) {
const Selector& selector = rules.at(i).selectors.at(0);
if (pseudoElement.compare(selector.pseudoElement(), Qt::CaseInsensitive) == 0) {
cache[part] = true;
@@ -2185,7 +2226,7 @@ static Origin defaultOrigin(int pe)
case PseudoElement_SpinBoxDownButton:
case PseudoElement_PushButtonMenuIndicator:
case PseudoElement_ComboBoxDropDown:
- case PseudoElement_ToolButtonDownArrow:
+ case PseudoElement_ToolButtonMenuIndicator:
case PseudoElement_MenuCheckMark:
case PseudoElement_MenuIcon:
case PseudoElement_MenuRightArrow:
@@ -2226,7 +2267,7 @@ static Qt::Alignment defaultPosition(int pe)
case PseudoElement_ScrollBarLast:
case PseudoElement_SpinBoxDownButton:
case PseudoElement_PushButtonMenuIndicator:
- case PseudoElement_ToolButtonDownArrow:
+ case PseudoElement_ToolButtonMenuIndicator:
return Qt::AlignRight | Qt::AlignBottom;
case PseudoElement_ScrollBarSubLine:
@@ -2246,6 +2287,9 @@ static Qt::Alignment defaultPosition(int pe)
case PseudoElement_SpinBoxDownArrow:
case PseudoElement_ComboBoxArrow:
case PseudoElement_DownArrow:
+ case PseudoElement_UpArrow:
+ case PseudoElement_LeftArrow:
+ case PseudoElement_RightArrow:
case PseudoElement_ToolButtonMenuArrow:
case PseudoElement_SliderGroove:
return Qt::AlignCenter;
@@ -2301,8 +2345,11 @@ QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rec
case PseudoElement_ComboBoxArrow:
case PseudoElement_DownArrow:
+ case PseudoElement_UpArrow:
+ case PseudoElement_LeftArrow:
+ case PseudoElement_RightArrow:
case PseudoElement_ToolButtonMenuArrow:
- case PseudoElement_ToolButtonDownArrow:
+ case PseudoElement_ToolButtonMenuIndicator:
case PseudoElement_MenuRightArrow:
if (sz.width() == -1)
sz.setWidth(13);
@@ -2454,11 +2501,12 @@ static QWidget *embeddedWidget(QWidget *w)
}
/** \internal
- in case w is an embedded widget, return the container widget
- (i.e, the widget for which the rules actualy apply)
- (exemple, if w is a lineedit embedded in a combobox, return the combobox)
+ Returns the widget whose style rules apply to \a w.
+
+ When \a w is an embedded widget, this is the container widget.
+ For example, if w is a line edit embedded in a combobox, this returns the combobox.
+ When \a w is not embedded, this function return \a w itself.
- if w is not embedded, return w itself
*/
static QWidget *containerWidget(const QWidget *w)
{
@@ -2546,8 +2594,9 @@ static quint64 extendedPseudoClass(const QWidget *w)
} else
if (const QPlainTextEdit *edit = qobject_cast<const QPlainTextEdit *>(w)) {
pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable);
- }
+ } else
#endif
+ {}
return pc;
}
@@ -2616,18 +2665,17 @@ void QStyleSheetStyle::setProperties(QWidget *w)
{
// scan decls for final occurrence of each "qproperty"
- QDuplicateTracker<QString> propertySet;
- propertySet.reserve(decls.size());
- for (int i = decls.count() - 1; i >= 0; --i) {
+ QDuplicateTracker<QString> propertySet(decls.size());
+ for (int i = decls.size() - 1; i >= 0; --i) {
const QString property = decls.at(i).d->property;
- if (!property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive))
+ if (!property.startsWith("qproperty-"_L1, Qt::CaseInsensitive))
continue;
if (!propertySet.hasSeen(property))
finals.append(i);
}
}
- for (int i = finals.count() - 1; i >= 0; --i) {
+ for (int i = finals.size() - 1; i >= 0; --i) {
const Declaration &decl = decls.at(finals[i]);
QStringView property = decl.d->property;
property = property.mid(10); // strip "qproperty-"
@@ -2661,6 +2709,9 @@ void QStyleSheetStyle::setProperties(QWidget *w)
default: v = decl.d->values.at(0).variant; break;
}
+ if (propertyL1 == QByteArrayView("styleSheet") && value == v)
+ continue;
+
w->setProperty(propertyL1, v);
}
}
@@ -2781,7 +2832,7 @@ static void updateObjects(const QList<const QObject *>& objects)
QCoreApplication::sendEvent(widget, &event);
QList<const QObject *> children;
children.reserve(widget->children().size() + 1);
- for (auto child: qAsConst(widget->children()))
+ for (auto child: std::as_const(widget->children()))
children.append(child);
updateObjects(children);
}
@@ -2849,7 +2900,9 @@ bool QStyleSheetStyle::initObject(const QObject *obj) const
const_cast<QWidget *>(w)->setAttribute(Qt::WA_StyleSheet, true);
}
- QObject::connect(obj, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(objectDestroyed(QObject*)), Qt::UniqueConnection);
+ connect(obj, &QObject::destroyed,
+ styleSheetCaches, &QStyleSheetStyleCaches::objectDestroyed,
+ Qt::UniqueConnection);
return true;
}
@@ -2863,7 +2916,7 @@ void QStyleSheetStyle::polish(QWidget *w)
if (styleSheetCaches->styleRulesCache.contains(w)) {
// the widget accessed its style pointer before polish (or repolish)
- // (exemple: the QAbstractSpinBox constructor ask for the stylehint)
+ // (example: the QAbstractSpinBox constructor ask for the stylehint)
styleSheetCaches->styleRulesCache.remove(w);
styleSheetCaches->hasStyleRuleCache.remove(w);
styleSheetCaches->renderRulesCache.remove(w);
@@ -2876,7 +2929,7 @@ void QStyleSheetStyle::polish(QWidget *w)
//set the WA_Hover attribute if one of the selector depends of the hover state
QList<StyleRule> rules = styleRules(w);
- for (int i = 0; i < rules.count(); i++) {
+ for (int i = 0; i < rules.size(); i++) {
const Selector& selector = rules.at(i).selectors.at(0);
quint64 negated = 0;
quint64 cssClass = selector.pseudoClass(&negated);
@@ -2893,10 +2946,10 @@ void QStyleSheetStyle::polish(QWidget *w)
QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled);
if ((rule.hasBorder() && rule.border()->hasBorderImage())
|| (rule.hasBackground() && !rule.background()->pixmap.isNull())) {
- QObject::connect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()), Qt::UniqueConnection);
- QObject::connect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()), Qt::UniqueConnection);
+ connect(sa->horizontalScrollBar(), &QScrollBar::valueChanged,
+ sa, QOverload<>::of(&QAbstractScrollArea::update), Qt::UniqueConnection);
+ connect(sa->verticalScrollBar(), &QScrollBar::valueChanged,
+ sa, QOverload<>::of(&QAbstractScrollArea::update), Qt::UniqueConnection);
}
}
#endif
@@ -2943,6 +2996,12 @@ void QStyleSheetStyle::polish(QWidget *w)
if (!rule.hasBackground() || rule.background()->isTransparent() || rule.hasBox()
|| (!rule.hasNativeBorder() && !rule.border()->isOpaque()))
w->setAttribute(Qt::WA_OpaquePaintEvent, false);
+ if (rule.hasBox() || !rule.hasNativeBorder()
+#if QT_CONFIG(pushbutton)
+ || (qobject_cast<QPushButton *>(w))
+#endif
+ )
+ w->setAttribute(Qt::WA_MacShowFocusRect, false);
}
}
@@ -2960,7 +3019,7 @@ void QStyleSheetStyle::repolish(QWidget *w)
{
QList<const QObject *> children;
children.reserve(w->children().size() + 1);
- for (auto child: qAsConst(w->children()))
+ for (auto child: std::as_const(w->children()))
children.append(child);
children.append(w);
styleSheetCaches->styleSheetCache.remove(w);
@@ -2993,13 +3052,13 @@ void QStyleSheetStyle::unpolish(QWidget *w)
setGeometry(w);
w->setAttribute(Qt::WA_StyleSheetTarget, false);
w->setAttribute(Qt::WA_StyleSheet, false);
- QObject::disconnect(w, nullptr, this, nullptr);
+ w->disconnect(this);
#if QT_CONFIG(scrollarea)
if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
- QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
- QObject::disconnect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
+ disconnect(sa->horizontalScrollBar(), &QScrollBar::valueChanged,
+ sa, QOverload<>::of(&QAbstractScrollArea::update));
+ disconnect(sa->verticalScrollBar(), &QScrollBar::valueChanged,
+ sa, QOverload<>::of(&QAbstractScrollArea::update));
}
#endif
baseStyle()->unpolish(w);
@@ -3015,16 +3074,6 @@ void QStyleSheetStyle::unpolish(QApplication *app)
styleSheetCaches->styleSheetCache.remove(qApp);
}
-#if QT_CONFIG(tabbar)
-inline static bool verticalTabs(QTabBar::Shape shape)
-{
- return shape == QTabBar::RoundedWest
- || shape == QTabBar::RoundedEast
- || shape == QTabBar::TriangularWest
- || shape == QTabBar::TriangularEast;
-}
-#endif // QT_CONFIG(tabbar)
-
void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
const QWidget *w) const
{
@@ -3228,8 +3277,39 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
rule.configurePalette(&toolOpt.palette, QPalette::ButtonText, QPalette::Button);
toolOpt.font = rule.font.resolve(toolOpt.font);
toolOpt.rect = rule.borderRect(opt->rect);
- bool customArrow = (tool->features & (QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup));
- bool customDropDown = tool->features & QStyleOptionToolButton::MenuButtonPopup;
+ const auto customArrowElement = [tool]{
+ switch (tool->arrowType) {
+ case Qt::DownArrow: return PseudoElement_DownArrow;
+ case Qt::UpArrow: return PseudoElement_UpArrow;
+ case Qt::LeftArrow: return PseudoElement_LeftArrow;
+ case Qt::RightArrow: return PseudoElement_RightArrow;
+ default: break;
+ }
+ return PseudoElement_None;
+ };
+ // if arrow/menu/indicators are requested, either draw them using the available rule,
+ // or let the base style draw them; but not both
+ const bool drawArrow = tool->features & QStyleOptionToolButton::Arrow;
+ bool customArrow = drawArrow && hasStyleRule(w, customArrowElement());
+ if (customArrow) {
+ toolOpt.features &= ~QStyleOptionToolButton::Arrow;
+ toolOpt.text = QString(); // we need to draw the arrow and the text ourselves
+ }
+ bool drawDropDown = tool->features & QStyleOptionToolButton::MenuButtonPopup;
+ bool customDropDown = drawDropDown && hasStyleRule(w, PseudoElement_ToolButtonMenu);
+ bool customDropDownArrow = false;
+ bool drawMenuIndicator = tool->features & QStyleOptionToolButton::HasMenu;
+ if (customDropDown) {
+ toolOpt.subControls &= ~QStyle::SC_ToolButtonMenu;
+ customDropDownArrow = hasStyleRule(w, PseudoElement_ToolButtonMenuArrow);
+ if (customDropDownArrow)
+ toolOpt.features &= ~(QStyleOptionToolButton::Menu | QStyleOptionToolButton::HasMenu);
+ }
+ const bool customMenuIndicator = (!drawDropDown && drawMenuIndicator)
+ && hasStyleRule(w, PseudoElement_ToolButtonMenuIndicator);
+ if (customMenuIndicator)
+ toolOpt.features &= ~QStyleOptionToolButton::HasMenu;
+
if (rule.hasNativeBorder()) {
if (tool->subControls & SC_ToolButton) {
//in some case (eg. the button is "auto raised") the style doesn't draw the background
@@ -3243,21 +3323,23 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (!(bflags & (State_Sunken | State_On | State_Raised)))
rule.drawBackground(p, toolOpt.rect);
}
- customArrow = customArrow && hasStyleRule(w, PseudoElement_ToolButtonDownArrow);
- if (customArrow)
- toolOpt.features &= ~QStyleOptionToolButton::HasMenu;
- customDropDown = customDropDown && hasStyleRule(w, PseudoElement_ToolButtonMenu);
- if (customDropDown)
- toolOpt.subControls &= ~QStyle::SC_ToolButtonMenu;
- if (rule.baseStyleCanDraw() && !(tool->features & QStyleOptionToolButton::Arrow)) {
- baseStyle()->drawComplexControl(cc, &toolOpt, p, w);
- } else {
- QWindowsStyle::drawComplexControl(cc, &toolOpt, p, w);
- }
-
- if (!customArrow && !customDropDown)
- return;
+ QStyleOptionToolButton nativeToolOpt(toolOpt);
+ // don't draw natively if we have a custom rule for menu indicators and/or buttons
+ if (customMenuIndicator)
+ nativeToolOpt.features &= ~(QStyleOptionToolButton::Menu | QStyleOptionToolButton::HasMenu);
+ if (customDropDown || customDropDownArrow)
+ nativeToolOpt.features &= ~(QStyleOptionToolButton::Menu | QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup);
+ // Let base or windows style draw the button, which will include the menu-button
+ if (rule.baseStyleCanDraw() && !(tool->features & QStyleOptionToolButton::Arrow))
+ baseStyle()->drawComplexControl(cc, &nativeToolOpt, p, w);
+ else
+ QWindowsStyle::drawComplexControl(cc, &nativeToolOpt, p, w);
+ // if we did draw natively, don't draw custom
+ if (nativeToolOpt.features & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::HasMenu))
+ drawMenuIndicator = false;
+ if (nativeToolOpt.features & QStyleOptionToolButton::MenuButtonPopup && !customDropDownArrow)
+ drawDropDown = false;
} else {
rule.drawRule(p, opt->rect);
toolOpt.rect = rule.contentsRect(opt->rect);
@@ -3266,33 +3348,78 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
drawControl(CE_ToolButtonLabel, &toolOpt, p, w);
}
- QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu);
- QRect r = subControlRect(CC_ToolButton, opt, QStyle::SC_ToolButtonMenu, w);
- if (customDropDown) {
+ const QRect cr = toolOpt.rect;
+ // Draw DropDownButton unless drawn before
+ if (drawDropDown) {
if (opt->subControls & QStyle::SC_ToolButtonMenu) {
+ QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu);
+ QRect menuButtonRect = subControlRect(CC_ToolButton, opt, QStyle::SC_ToolButtonMenu, w);
if (subRule.hasDrawable()) {
- subRule.drawRule(p, r);
+ subRule.drawRule(p, menuButtonRect);
} else {
- toolOpt.rect = r;
+ toolOpt.rect = menuButtonRect;
baseStyle()->drawPrimitive(PE_IndicatorButtonDropDown, &toolOpt, p, w);
}
+
+ if (customDropDownArrow || drawMenuIndicator) {
+ QRenderRule arrowRule = renderRule(w, opt, PseudoElement_ToolButtonMenuArrow);
+ QRect arrowRect = arrowRule.hasGeometry()
+ ? positionRect(w, arrowRule, PseudoElement_ToolButtonMenuArrow, menuButtonRect, toolOpt.direction)
+ : arrowRule.contentsRect(menuButtonRect);
+ if (arrowRule.hasDrawable()) {
+ arrowRule.drawRule(p, arrowRect);
+ } else {
+ toolOpt.rect = arrowRect;
+ baseStyle()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &toolOpt, p, w);
+ }
+ }
}
- }
+ } else if (drawMenuIndicator) {
+ QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenuIndicator);
- if (customArrow) {
- QRenderRule subRule2 = customDropDown ? renderRule(w, opt, PseudoElement_ToolButtonMenuArrow)
- : renderRule(w, opt, PseudoElement_ToolButtonDownArrow);
- QRect r2 = customDropDown
- ? positionRect(w, subRule, subRule2, PseudoElement_ToolButtonMenuArrow, r, opt->direction)
- : positionRect(w, rule, subRule2, PseudoElement_ToolButtonDownArrow, opt->rect, opt->direction);
- if (subRule2.hasDrawable()) {
- subRule2.drawRule(p, r2);
+ // content padding does not impact the indicator, so use the original rect to
+ // calculate position of the sub element within the toplevel rule
+ QRect r = positionRect(w, rule, subRule, PseudoElement_ToolButtonMenuIndicator, opt->rect, toolOpt.direction);
+ if (subRule.hasDrawable()) {
+ subRule.drawRule(p, r);
} else {
- toolOpt.rect = r2;
+ toolOpt.rect = r;
baseStyle()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &toolOpt, p, w);
}
}
+ toolOpt.rect = cr;
+
+ // If we don't have a custom arrow, then the arrow will have been rendered
+ // already by the base style when drawing the label.
+ if (customArrow) {
+ const auto arrowElement = customArrowElement();
+ QRenderRule subRule = renderRule(w, opt, arrowElement);
+ QRect arrowRect = subRule.hasGeometry() ? positionRect(w, subRule, arrowElement, toolOpt.rect, toolOpt.direction)
+ : subRule.contentsRect(toolOpt.rect);
+ switch (toolOpt.toolButtonStyle) {
+ case Qt::ToolButtonIconOnly:
+ break;
+ case Qt::ToolButtonTextOnly:
+ case Qt::ToolButtonTextBesideIcon:
+ case Qt::ToolButtonTextUnderIcon: {
+ // The base style needs to lay out the contents and will render the styled
+ // arrow icons, unless the geometry is defined in the style sheet.
+ toolOpt.text = tool->text;
+ if (!subRule.hasGeometry())
+ toolOpt.features |= QStyleOptionToolButton::Arrow;
+ drawControl(CE_ToolButtonLabel, &toolOpt, p, w);
+ if (!subRule.hasGeometry())
+ return;
+ break;
+ }
+ case Qt::ToolButtonFollowStyle:
+ // QToolButton handles this, so must never happen
+ Q_ASSERT(false);
+ break;
+ }
+ subRule.drawRule(p, arrowRect);
+ }
return;
}
break;
@@ -3374,14 +3501,14 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (hasStyleRule(w, PseudoElement_MdiCloseButton)
|| hasStyleRule(w, PseudoElement_MdiNormalButton)
|| hasStyleRule(w, PseudoElement_MdiMinButton)) {
- QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList();
+ QList<QVariant> layout = rule.styleHint("button-layout"_L1).toList();
if (layout.isEmpty())
- layout = subControlLayout(QLatin1String("mNX"));
+ layout = subControlLayout("mNX");
QStyleOptionComplex optCopy(*opt);
optCopy.subControls = { };
- for (int i = 0; i < layout.count(); i++) {
- int layoutButton = layout[i].toInt();
+ for (const QVariant &val : std::as_const(layout)) {
+ int layoutButton = val.toInt();
if (layoutButton < PseudoElement_MdiCloseButton
|| layoutButton > PseudoElement_MdiNormalButton)
continue;
@@ -3412,6 +3539,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
break;
subRule.drawRule(p, opt->rect);
QHash<QStyle::SubControl, QRect> layout = titleBarLayout(w, tb);
+ const auto paintDeviceDpr = p->device()->devicePixelRatio();
QRect ir;
ir = layout[SC_TitleBarLabel];
@@ -3422,8 +3550,6 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
p->drawText(ir.x(), ir.y(), ir.width(), ir.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, tb->text);
}
- QPixmap pm;
-
ir = layout[SC_TitleBarSysMenu];
if (ir.isValid()) {
QRenderRule subSubRule = renderRule(w, opt, PseudoElement_TitleBarSysMenu);
@@ -3433,7 +3559,9 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
tb->icon.paint(p, ir);
} else {
int iconSize = pixelMetric(PM_SmallIconSize, tb, w);
- pm = standardIcon(SP_TitleBarMenuButton, nullptr, w).pixmap(iconSize, iconSize);
+ const QSize sz(iconSize, iconSize);
+ const auto pm = standardIcon(SP_TitleBarMenuButton, nullptr, w)
+ .pixmap(sz, paintDeviceDpr);
drawItemPixmap(p, ir, Qt::AlignCenter, pm);
}
}
@@ -3443,15 +3571,14 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
QRenderRule subSubRule = renderRule(w, opt, PseudoElement_TitleBarCloseButton);
subSubRule.drawRule(p, ir);
- QSize sz = subSubRule.contentsRect(ir).size();
- if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool)
- pm = standardIcon(SP_DockWidgetCloseButton, nullptr, w).pixmap(sz);
- else
- pm = standardIcon(SP_TitleBarCloseButton, nullptr, w).pixmap(sz);
+ const QSize sz = subSubRule.contentsRect(ir).size();
+ const auto type = ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool)
+ ? SP_DockWidgetCloseButton : SP_TitleBarCloseButton;
+ const auto pm = standardIcon(type, nullptr, w).pixmap(sz, paintDeviceDpr);
drawItemPixmap(p, ir, Qt::AlignCenter, pm);
}
- int pes[] = {
+ constexpr std::array<int, 6> pes = {
PseudoElement_TitleBarMaxButton,
PseudoElement_TitleBarMinButton,
PseudoElement_TitleBarNormalButton,
@@ -3460,15 +3587,15 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
PseudoElement_TitleBarContextHelpButton
};
- for (unsigned int i = 0; i < sizeof(pes)/sizeof(int); i++) {
- int pe = pes[i];
+ for (int pe : pes) {
QStyle::SubControl sc = knownPseudoElements[pe].subControl;
ir = layout[sc];
if (!ir.isValid())
continue;
QRenderRule subSubRule = renderRule(w, opt, pe);
subSubRule.drawRule(p, ir);
- pm = standardIcon(subControlIcon(pe), nullptr, w).pixmap(subSubRule.contentsRect(ir).size());
+ const QSize sz = subSubRule.contentsRect(ir).size();
+ const auto pm = standardIcon(subControlIcon(pe), nullptr, w).pixmap(sz, paintDeviceDpr);
drawItemPixmap(p, ir, Qt::AlignCenter, pm);
}
@@ -3484,6 +3611,37 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
baseStyle()->drawComplexControl(cc, opt, p, w);
}
+void QStyleSheetStyle::renderMenuItemIcon(const QStyleOptionMenuItem *mi, QPainter *p, const QWidget *w,
+ const QRect &rect, QRenderRule &subRule) const
+{
+ const QIcon::Mode mode = mi->state & QStyle::State_Enabled
+ ? (mi->state & QStyle::State_Selected ? QIcon::Active : QIcon::Normal)
+ : QIcon::Disabled;
+ const bool checked = mi->checkType != QStyleOptionMenuItem::NotCheckable && mi->checked;
+ const auto iconSize = pixelMetric(PM_SmallIconSize, mi, w);
+ const QSize sz(iconSize, iconSize);
+ const QPixmap pixmap(mi->icon.pixmap(sz, p->device()->devicePixelRatio(), mode,
+ checked ? QIcon::On : QIcon::Off));
+ const int pixw = pixmap.width() / pixmap.devicePixelRatio();
+ const int pixh = pixmap.height() / pixmap.devicePixelRatio();
+ QRenderRule iconRule = renderRule(w, mi, PseudoElement_MenuIcon);
+ if (!iconRule.hasGeometry()) {
+ iconRule.geo = new QStyleSheetGeometryData(pixw, pixh, pixw, pixh, -1, -1);
+ } else {
+ iconRule.geo->width = pixw;
+ iconRule.geo->height = pixh;
+ }
+ QRect iconRect = positionRect(w, subRule, iconRule, PseudoElement_MenuIcon, rect, mi->direction);
+ if (mi->direction == Qt::LeftToRight)
+ iconRect.moveLeft(iconRect.left());
+ else
+ iconRect.moveRight(iconRect.right());
+ iconRule.drawRule(p, iconRect);
+ QRect pmr(0, 0, pixw, pixh);
+ pmr.moveCenter(iconRect.center());
+ p->drawPixmap(pmr.topLeft(), pixmap);
+}
+
void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p,
const QWidget *w) const
{
@@ -3597,7 +3755,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (button->state & State_On)
state = QIcon::On;
- QPixmap pixmap = icon.pixmap(button->iconSize, mode, state);
+ const auto paintDeviceDpr = p->device()->devicePixelRatio();
+ QPixmap pixmap = icon.pixmap(button->iconSize, paintDeviceDpr, mode, state);
int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio();
int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio();
int labelWidth = pixmapWidth;
@@ -3764,42 +3923,18 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
}
mi.palette.setBrush(QPalette::HighlightedText, mi.palette.brush(QPalette::ButtonText));
- bool checkable = mi.checkType != QStyleOptionMenuItem::NotCheckable;
- bool checked = checkable ? mi.checked : false;
-
- bool dis = !(opt->state & QStyle::State_Enabled),
- act = opt->state & QStyle::State_Selected;
-
int textRectOffset = m->maxIconWidth;
if (!mi.icon.isNull()) {
- QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
- if (act && !dis)
- mode = QIcon::Active;
- const QPixmap pixmap(mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode, checked ? QIcon::On : QIcon::Off));
- const int pixw = pixmap.width() / pixmap.devicePixelRatio();
- const int pixh = pixmap.height() / pixmap.devicePixelRatio();
- QRenderRule iconRule = renderRule(w, opt, PseudoElement_MenuIcon);
- if (!iconRule.hasGeometry()) {
- iconRule.geo = new QStyleSheetGeometryData(pixw, pixh, pixw, pixh, -1, -1);
- } else {
- iconRule.geo->width = pixw;
- iconRule.geo->height = pixh;
- }
- QRect iconRect = positionRect(w, subRule, iconRule, PseudoElement_MenuIcon, opt->rect, opt->direction);
- if (opt->direction == Qt::LeftToRight)
- iconRect.moveLeft(iconRect.left());
- else
- iconRect.moveRight(iconRect.right());
- iconRule.drawRule(p, iconRect);
- QRect pmr(0, 0, pixw, pixh);
- pmr.moveCenter(iconRect.center());
- p->drawPixmap(pmr.topLeft(), pixmap);
+ renderMenuItemIcon(&mi, p, w, opt->rect, subRule);
} else if (mi.menuHasCheckableItems) {
- QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark);
+ const bool checkable = mi.checkType != QStyleOptionMenuItem::NotCheckable;
+ const bool checked = checkable ? mi.checked : false;
+
+ const QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark);
const QRect cmRect = positionRect(w, subRule, subSubRule, PseudoElement_MenuCheckMark, opt->rect, opt->direction);
if (checkable && (subSubRule.hasDrawable() || checked)) {
QStyleOptionMenuItem newMi = mi;
- if (!dis)
+ if (opt->state & QStyle::State_Enabled)
newMi.state |= State_Enabled;
if (mi.checked)
newMi.state |= State_On;
@@ -3820,7 +3955,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
int text_flags = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
if (!styleHint(SH_UnderlineShortcut, &mi, w))
text_flags |= Qt::TextHideMnemonic;
- int t = s.indexOf(QLatin1Char('\t'));
+ qsizetype t = s.indexOf(u'\t');
if (t >= 0) {
QRect vShortcutRect = visualRect(opt->direction, mi.rect,
QRect(textRect.topRight(), QPoint(mi.rect.right(), textRect.bottom())));
@@ -3836,11 +3971,22 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
mi.rect = positionRect(w, subRule, subRule2, PseudoElement_MenuRightArrow, opt->rect, mi.direction);
drawPrimitive(arrow, &mi, p, w);
}
+ } else if (!mi.icon.isNull() && hasStyleRule(w, PseudoElement_MenuIcon)) {
+ // we wouldn't be here if the item itself would be styled, so now we only want
+ // the text from the default style, and then draw the icon ourselves.
+ QStyleOptionMenuItem newMi = mi;
+ newMi.icon = {};
+ newMi.checkType = QStyleOptionMenuItem::NotCheckable;
+ if (rule.baseStyleCanDraw() && subRule.baseStyleCanDraw())
+ baseStyle()->drawControl(ce, &newMi, p, w);
+ else
+ ParentStyle::drawControl(ce, &newMi, p, w);
+ renderMenuItemIcon(&mi, p, w, opt->rect, subRule);
} else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) {
QWindowsStyle::drawControl(ce, &mi, p, w);
if (mi.checkType != QStyleOptionMenuItem::NotCheckable && !mi.checked) {
// We have a style defined, but QWindowsStyle won't draw anything if not checked.
- // So we mimick what QWindowsStyle would do.
+ // So we mimic what QWindowsStyle would do.
int checkcol = qMax<int>(mi.maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth);
QRect vCheckRect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x(), mi.rect.y(), checkcol, mi.rect.height()));
if (mi.state.testFlag(State_Enabled) && mi.state.testFlag(State_Selected)) {
@@ -3912,7 +4058,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (spacing == -1)
spacing = 6;
QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
- QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
+ const auto paintDeviceDpr = p->device()->devicePixelRatio();
+ QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, paintDeviceDpr, mode);
QRect iconRect(editRect);
iconRect.setWidth(cb->iconSize.width());
iconRect = alignedRect(cb->direction,
@@ -3973,8 +4120,23 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
case CE_HeaderLabel:
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
- QStyleOptionHeader hdr(*header);
+ QStyleOptionHeaderV2 hdr;
+ QStyleOptionHeader &v1Copy = hdr;
+ if (auto v2 = qstyleoption_cast<const QStyleOptionHeaderV2 *>(opt))
+ hdr = *v2;
+ else
+ v1Copy = *header;
QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);
+ if (hasStyleRule(w, PseudoElement_HeaderViewUpArrow)
+ || hasStyleRule(w, PseudoElement_HeaderViewDownArrow)) {
+ if (hdr.sortIndicator != QStyleOptionHeader::None) {
+ const QRect arrowRect = subElementRect(SE_HeaderArrow, opt, w);
+ if (hdr.orientation == Qt::Horizontal)
+ hdr.rect.setWidth(hdr.rect.width() - arrowRect.width());
+ else
+ hdr.rect.setHeight(hdr.rect.height() - arrowRect.height());
+ }
+ }
subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button);
if (subRule.hasFont) {
QFont oldFont = p->font();
@@ -4073,6 +4235,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
--chunkCount;
};
} else if (chunkWidth > 0) {
+ const auto ceil = [](qreal x) { return int(x) + (x > 0 && x != int(x)); };
const int chunkCount = ceil(qreal(fillWidth)/chunkWidth);
int x = reverse ? r.left() + r.width() - chunkWidth : r.x();
@@ -4113,12 +4276,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (rule.hasDrawable()) {
rule.drawFrame(p, opt->rect);
p->save();
- switch (sgOpt->corner) {
- case Qt::BottomRightCorner: break;
- case Qt::BottomLeftCorner: p->rotate(90); break;
- case Qt::TopLeftCorner: p->rotate(180); break;
- case Qt::TopRightCorner: p->rotate(270); break;
- default: break;
+ static constexpr int rotation[] = { 180, 270, 90, 0 };
+ if (rotation[sgOpt->corner]) {
+ p->translate(opt->rect.center());
+ p->rotate(rotation[sgOpt->corner]);
+ p->translate(-opt->rect.center());
}
rule.drawImage(p, opt->rect);
p->restore();
@@ -4202,15 +4364,47 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
case CE_ItemViewItem:
if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem);
- if (subRule.hasDrawable() || hasStyleRule(w, PseudoElement_Indicator)) {
- QStyleOptionViewItem optCopy(*vopt);
+ QStyleOptionViewItem optCopy(*vopt);
+ if (subRule.hasDrawable()) {
subRule.configurePalette(&optCopy.palette, vopt->state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text,
vopt->state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base);
QWindowsStyle::drawControl(ce, &optCopy, p, w);
} else {
- QStyleOptionViewItem voptCopy(*vopt);
- subRule.configurePalette(&voptCopy.palette, QPalette::Text, QPalette::NoRole);
- baseStyle()->drawControl(ce, &voptCopy, p, w);
+ p->save();
+ if (hasStyleRule(w, PseudoElement_Indicator)) {
+ // there is a rule for the indicator, but no rule for the item itself (otherwise
+ // the previous path would have been taken); only draw the indicator using the
+ // rule (via QWindows/QCommonStyle), then let the base style handle the rest.
+ QStyleOptionViewItem optIndicator(*vopt);
+ subRule.configurePalette(&optIndicator.palette,
+ vopt->state & QStyle::State_Selected
+ ? QPalette::HighlightedText
+ : QPalette::Text,
+ vopt->state & QStyle::State_Selected
+ ? QPalette::Highlight
+ : QPalette::Base);
+ // only draw the indicator; no text, icon or background
+ optIndicator.backgroundBrush = Qt::NoBrush; // no background
+ optIndicator.text.clear();
+ optIndicator.icon = QIcon();
+ QWindowsStyle::drawControl(ce, &optIndicator, p, w);
+
+ // Now draw text, background,icon, and highlight, but not the indicator with
+ // the base style. Since we can't turn off HasCheckIndicator to prevent the base
+ // style from drawing the check indicator again (it would change how the item
+ // gets laid out) we have to clip the indicator that's already been painted.
+ const QRect crStyle = subElementRect(QStyle::SE_ItemViewItemCheckIndicator,
+ &optIndicator, w);
+ const QRect crBase = baseStyle()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator,
+ &optIndicator, w);
+ const QRegion clipRegion = QRegion(p->hasClipping() ? p->clipRegion()
+ : QRegion(optIndicator.rect))
+ - crStyle.united(crBase);
+ p->setClipRegion(clipRegion);
+ }
+ subRule.configurePalette(&optCopy.palette, QPalette::Text, QPalette::NoRole);
+ baseStyle()->drawControl(ce, &optCopy, p, w);
+ p->restore();
}
return;
}
@@ -4228,6 +4422,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
case CE_TabBarTabLabel:
case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
+ const auto foregroundRole = w ? w->foregroundRole() : QPalette::WindowText;
QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);
QRect r = positionRect(w, subRule, PseudoElement_TabBarTab, opt->rect, opt->direction);
if (ce == CE_TabBarTabShape && subRule.hasDrawable() && tab->shape < QTabBar::TriangularNorth) {
@@ -4235,7 +4430,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
return;
}
QStyleOptionTab tabCopy(*tab);
- subRule.configurePalette(&tabCopy.palette, QPalette::WindowText, QPalette::Base);
+ subRule.configurePalette(&tabCopy.palette, foregroundRole, QPalette::Base);
QFont oldFont = p->font();
if (subRule.hasFont)
p->setFont(subRule.font.resolve(p->font()));
@@ -4293,7 +4488,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
QString titleText = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, r.width());
drawItemText(p, r,
- alignment, dwOpt->palette,
+ alignment | Qt::TextHideMnemonic, dwOpt->palette,
dwOpt->state & State_Enabled, titleText,
QPalette::WindowText);
@@ -4455,14 +4650,16 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
case PE_PanelLineEdit:
if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
-#if QT_CONFIG(spinbox)
- if (w && qobject_cast<const QAbstractSpinBox *>(w->parentWidget())) {
- QRenderRule spinboxRule = renderRule(w->parentWidget(), opt);
- if (!spinboxRule.hasNativeBorder() || !spinboxRule.baseStyleCanDraw())
- return;
- rule = spinboxRule;
+ // Fall back to container widget's render rule
+ if (w) {
+ if (QWidget *container = containerWidget(w); container != w) {
+ QRenderRule containerRule = renderRule(container, opt);
+ if (!containerRule.hasNativeBorder() || !containerRule.baseStyleCanDraw())
+ return;
+ rule = containerRule;
+ }
}
-#endif
+
if (rule.hasNativeBorder()) {
QStyleOptionFrame frmOpt(*frm);
rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);
@@ -4571,10 +4768,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
QRenderRule subRule = renderRule(w, opt, PseudoElement_TreeViewBranch);
if (subRule.hasDrawable()) {
- if ((vopt->state & QStyle::State_Selected) && vopt->showDecorationSelected)
- p->fillRect(vopt->rect, vopt->palette.highlight());
- else if (vopt->features & QStyleOptionViewItem::Alternate)
- p->fillRect(vopt->rect, vopt->palette.alternateBase());
+ proxy()->drawPrimitive(PE_PanelItemViewRow, vopt, p, w);
subRule.drawRule(p, opt->rect);
} else {
baseStyle()->drawPrimitive(pe, vopt, p, w);
@@ -4642,6 +4836,17 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
pseudoElement = PseudoElement_DockWidgetSeparator;
break;
+ case PE_PanelItemViewRow:
+ // For compatibility reasons, QTreeView draws different parts of
+ // the background of an item row separately, before calling the
+ // delegate to draw the item. The row background of an item is
+ // however not separately styleable through a style sheet, but
+ // only indirectly through the background of the item. To get the
+ // same background for all parts drawn by QTreeView, we have to
+ // use the background rule for the item here.
+ if (renderRule(w, opt, PseudoElement_ViewItem).hasBackground())
+ pseudoElement = PseudoElement_ViewItem;
+ break;
case PE_PanelItemViewItem:
pseudoElement = PseudoElement_ViewItem;
break;
@@ -4668,6 +4873,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
w = w->parentWidget(); //match on the QTabBar instead of the CloseButton
}
pseudoElement = PseudoElement_TabBarTabCloseButton;
+ break;
#endif
default:
@@ -4769,8 +4975,19 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
case PM_MenuButtonIndicator:
#if QT_CONFIG(toolbutton)
// QToolButton adds this directly to the width
- if (qobject_cast<const QToolButton *>(w) && (rule.hasBox() || !rule.hasNativeBorder()))
- return 0;
+ if (qobject_cast<const QToolButton *>(w)) {
+ if (rule.hasBox() || !rule.hasNativeBorder())
+ return 0;
+ if (const auto *tbOpt = qstyleoption_cast<const QStyleOptionToolButton*>(opt)) {
+ if (tbOpt->features & QStyleOptionToolButton::MenuButtonPopup)
+ subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu);
+ else
+ subRule = renderRule(w, opt, PseudoElement_ToolButtonMenuIndicator);
+ if (subRule.hasContentsSize())
+ return subRule.size().width();
+ }
+ break;
+ }
#endif
subRule = renderRule(w, opt, PseudoElement_PushButtonMenuIndicator);
if (subRule.hasContentsSize())
@@ -4915,8 +5132,14 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
if (!rule.hasNativeBorder() || rule.hasBox())
return 0;
break;
+
+ case PM_ScrollView_ScrollBarOverlap:
+ if (!proxy()->styleHint(SH_ScrollBar_Transient, opt, w))
+ return 0;
+ break;
#endif // QT_CONFIG(scrollbar)
+
case PM_ProgressBarChunkWidth:
subRule = renderRule(w, opt, PseudoElement_ProgressBarChunk);
if (subRule.hasContentsSize()) {
@@ -4989,9 +5212,8 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
case PM_MessageBoxIconSize:
case PM_ButtonIconSize:
case PM_SmallIconSize:
- if (rule.hasStyleHint(QLatin1String("icon-size"))) {
- return rule.styleHint(QLatin1String("icon-size")).toSize().width();
- }
+ if (rule.hasStyleHint("icon-size"_L1))
+ return rule.styleHint("icon-size"_L1).toSize().width();
break;
case PM_DockWidgetTitleMargin: {
@@ -5123,8 +5345,17 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
}
return subRule.size(sz);
}
- return subRule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w)
- : QWindowsStyle::sizeFromContents(ct, opt, sz, w);
+ sz = subRule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w)
+ : QWindowsStyle::sizeFromContents(ct, opt, sz, w);
+ if (hasStyleRule(w, PseudoElement_HeaderViewDownArrow)
+ || hasStyleRule(w, PseudoElement_HeaderViewUpArrow)) {
+ const QRect arrowRect = subElementRect(SE_HeaderArrow, opt, w);
+ if (hdr->orientation == Qt::Horizontal)
+ sz.rwidth() += arrowRect.width();
+ else
+ sz.rheight() += arrowRect.height();
+ }
+ return sz;
}
}
break;
@@ -5175,20 +5406,21 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
}
if ((pe == PseudoElement_Item) && (subRule.hasBox() || subRule.hasBorder() || subRule.hasFont)) {
QSize sz(csz);
- if (mi->text.contains(QLatin1Char('\t')))
+ if (mi->text.contains(u'\t'))
sz.rwidth() += 12; //as in QCommonStyle
- bool checkable = mi->checkType != QStyleOptionMenuItem::NotCheckable;
if (!mi->icon.isNull()) {
const int pmSmall = pixelMetric(PM_SmallIconSize);
const QSize pmSize = mi->icon.actualSize(QSize(pmSmall, pmSmall));
- sz.rwidth() += pmSize.width() + 4;
- } else if (checkable) {
+ sz.rwidth() += std::max(mi->maxIconWidth, pmSize.width()) + 4;
+ } else if (mi->menuHasCheckableItems) {
QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark);
QRect checkmarkRect = positionRect(w, subRule, subSubRule, PseudoElement_MenuCheckMark, opt->rect, opt->direction);
sz.rwidth() += std::max(mi->maxIconWidth, checkmarkRect.width()) + 4;
+ } else {
+ sz.rwidth() += mi->maxIconWidth;
}
if (subRule.hasFont) {
- QFontMetrics fm(subRule.font);
+ QFontMetrics fm(subRule.font.resolve(mi->font));
const QRect r = fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, mi->text);
sz = sz.expandedTo(r.size());
}
@@ -5221,15 +5453,38 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
#if QT_CONFIG(tabbar)
case CT_TabBarTab: {
QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);
- if (subRule.hasBox() || !subRule.hasNativeBorder()) {
+ if (subRule.hasBox() || !subRule.hasNativeBorder() || subRule.hasFont) {
int spaceForIcon = 0;
bool vertical = false;
+ QString text;
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
if (!tab->icon.isNull())
spaceForIcon = 6 /* icon offset */ + 4 /* spacing */ + 2 /* magic */; // ###: hardcoded to match with common style
vertical = verticalTabs(tab->shape);
+ text = tab->text;
}
- sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0);
+ if (subRule.hasBox() || !subRule.hasNativeBorder())
+ sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0);
+ if (subRule.hasFont) {
+ // first we remove the space needed for the text using the default font
+ const QSize oldTextSize = opt->fontMetrics.size(Qt::TextShowMnemonic, text);
+ (vertical ? sz.rheight() : sz.rwidth()) -= oldTextSize.width();
+
+ // then we add the space needed when using the rule font to the relevant
+ // dimension, and constraint the other dimension to the maximum to make
+ // sure we don't grow, but also don't clip icons or buttons.
+ const QFont ruleFont = subRule.font.resolve(w->font());
+ const QFontMetrics fm(ruleFont);
+ const QSize textSize = fm.size(Qt::TextShowMnemonic, text);
+ if (vertical) {
+ sz.rheight() += textSize.width();
+ sz.rwidth() = qMax(textSize.height(), sz.width());
+ } else {
+ sz.rwidth() += textSize.width();
+ sz.rheight() = qMax(textSize.height(), sz.height());
+ }
+ }
+
return subRule.boxSize(subRule.adjustSize(sz));
}
sz = subRule.adjustSize(csz);
@@ -5244,13 +5499,13 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
&& !hasStyleRule(w, PseudoElement_MdiMinButton))
break;
- QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList();
+ QList<QVariant> layout = rule.styleHint("button-layout"_L1).toList();
if (layout.isEmpty())
- layout = subControlLayout(QLatin1String("mNX"));
+ layout = subControlLayout("mNX");
int width = 0, height = 0;
- for (int i = 0; i < layout.count(); i++) {
- int layoutButton = layout[i].toInt();
+ for (const QVariant &val : std::as_const(layout)) {
+ int layoutButton = val.toInt();
if (layoutButton < PseudoElement_MdiCloseButton
|| layoutButton > PseudoElement_MdiNormalButton)
continue;
@@ -5288,65 +5543,65 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
/*!
\internal
*/
-static QLatin1String propertyNameForStandardPixmap(QStyle::StandardPixmap sp)
+static QLatin1StringView propertyNameForStandardPixmap(QStyle::StandardPixmap sp)
{
switch (sp) {
- case QStyle::SP_TitleBarMenuButton: return QLatin1String("titlebar-menu-icon");
- case QStyle::SP_TitleBarMinButton: return QLatin1String("titlebar-minimize-icon");
- case QStyle::SP_TitleBarMaxButton: return QLatin1String("titlebar-maximize-icon");
- case QStyle::SP_TitleBarCloseButton: return QLatin1String("titlebar-close-icon");
- case QStyle::SP_TitleBarNormalButton: return QLatin1String("titlebar-normal-icon");
- case QStyle::SP_TitleBarShadeButton: return QLatin1String("titlebar-shade-icon");
- case QStyle::SP_TitleBarUnshadeButton: return QLatin1String("titlebar-unshade-icon");
- case QStyle::SP_TitleBarContextHelpButton: return QLatin1String("titlebar-contexthelp-icon");
- case QStyle::SP_DockWidgetCloseButton: return QLatin1String("dockwidget-close-icon");
- case QStyle::SP_MessageBoxInformation: return QLatin1String("messagebox-information-icon");
- case QStyle::SP_MessageBoxWarning: return QLatin1String("messagebox-warning-icon");
- case QStyle::SP_MessageBoxCritical: return QLatin1String("messagebox-critical-icon");
- case QStyle::SP_MessageBoxQuestion: return QLatin1String("messagebox-question-icon");
- case QStyle::SP_DesktopIcon: return QLatin1String("desktop-icon");
- case QStyle::SP_TrashIcon: return QLatin1String("trash-icon");
- case QStyle::SP_ComputerIcon: return QLatin1String("computer-icon");
- case QStyle::SP_DriveFDIcon: return QLatin1String("floppy-icon");
- case QStyle::SP_DriveHDIcon: return QLatin1String("harddisk-icon");
- case QStyle::SP_DriveCDIcon: return QLatin1String("cd-icon");
- case QStyle::SP_DriveDVDIcon: return QLatin1String("dvd-icon");
- case QStyle::SP_DriveNetIcon: return QLatin1String("network-icon");
- case QStyle::SP_DirOpenIcon: return QLatin1String("directory-open-icon");
- case QStyle::SP_DirClosedIcon: return QLatin1String("directory-closed-icon");
- case QStyle::SP_DirLinkIcon: return QLatin1String("directory-link-icon");
- case QStyle::SP_FileIcon: return QLatin1String("file-icon");
- case QStyle::SP_FileLinkIcon: return QLatin1String("file-link-icon");
- case QStyle::SP_FileDialogStart: return QLatin1String("filedialog-start-icon");
- case QStyle::SP_FileDialogEnd: return QLatin1String("filedialog-end-icon");
- case QStyle::SP_FileDialogToParent: return QLatin1String("filedialog-parent-directory-icon");
- case QStyle::SP_FileDialogNewFolder: return QLatin1String("filedialog-new-directory-icon");
- case QStyle::SP_FileDialogDetailedView: return QLatin1String("filedialog-detailedview-icon");
- case QStyle::SP_FileDialogInfoView: return QLatin1String("filedialog-infoview-icon");
- case QStyle::SP_FileDialogContentsView: return QLatin1String("filedialog-contentsview-icon");
- case QStyle::SP_FileDialogListView: return QLatin1String("filedialog-listview-icon");
- case QStyle::SP_FileDialogBack: return QLatin1String("filedialog-backward-icon");
- case QStyle::SP_DirIcon: return QLatin1String("directory-icon");
- case QStyle::SP_DialogOkButton: return QLatin1String("dialog-ok-icon");
- case QStyle::SP_DialogCancelButton: return QLatin1String("dialog-cancel-icon");
- case QStyle::SP_DialogHelpButton: return QLatin1String("dialog-help-icon");
- case QStyle::SP_DialogOpenButton: return QLatin1String("dialog-open-icon");
- case QStyle::SP_DialogSaveButton: return QLatin1String("dialog-save-icon");
- case QStyle::SP_DialogCloseButton: return QLatin1String("dialog-close-icon");
- case QStyle::SP_DialogApplyButton: return QLatin1String("dialog-apply-icon");
- case QStyle::SP_DialogResetButton: return QLatin1String("dialog-reset-icon");
- case QStyle::SP_DialogDiscardButton: return QLatin1String("dialog-discard-icon");
- case QStyle::SP_DialogYesButton: return QLatin1String("dialog-yes-icon");
- case QStyle::SP_DialogNoButton: return QLatin1String("dialog-no-icon");
- case QStyle::SP_ArrowUp: return QLatin1String("uparrow-icon");
- case QStyle::SP_ArrowDown: return QLatin1String("downarrow-icon");
- case QStyle::SP_ArrowLeft: return QLatin1String("leftarrow-icon");
- case QStyle::SP_ArrowRight: return QLatin1String("rightarrow-icon");
- case QStyle::SP_ArrowBack: return QLatin1String("backward-icon");
- case QStyle::SP_ArrowForward: return QLatin1String("forward-icon");
- case QStyle::SP_DirHomeIcon: return QLatin1String("home-icon");
- case QStyle::SP_LineEditClearButton: return QLatin1String("lineedit-clear-button-icon");
- default: return QLatin1String("");
+ case QStyle::SP_TitleBarMenuButton: return "titlebar-menu-icon"_L1;
+ case QStyle::SP_TitleBarMinButton: return "titlebar-minimize-icon"_L1;
+ case QStyle::SP_TitleBarMaxButton: return "titlebar-maximize-icon"_L1;
+ case QStyle::SP_TitleBarCloseButton: return "titlebar-close-icon"_L1;
+ case QStyle::SP_TitleBarNormalButton: return "titlebar-normal-icon"_L1;
+ case QStyle::SP_TitleBarShadeButton: return "titlebar-shade-icon"_L1;
+ case QStyle::SP_TitleBarUnshadeButton: return "titlebar-unshade-icon"_L1;
+ case QStyle::SP_TitleBarContextHelpButton: return "titlebar-contexthelp-icon"_L1;
+ case QStyle::SP_DockWidgetCloseButton: return "dockwidget-close-icon"_L1;
+ case QStyle::SP_MessageBoxInformation: return "messagebox-information-icon"_L1;
+ case QStyle::SP_MessageBoxWarning: return "messagebox-warning-icon"_L1;
+ case QStyle::SP_MessageBoxCritical: return "messagebox-critical-icon"_L1;
+ case QStyle::SP_MessageBoxQuestion: return "messagebox-question-icon"_L1;
+ case QStyle::SP_DesktopIcon: return "desktop-icon"_L1;
+ case QStyle::SP_TrashIcon: return "trash-icon"_L1;
+ case QStyle::SP_ComputerIcon: return "computer-icon"_L1;
+ case QStyle::SP_DriveFDIcon: return "floppy-icon"_L1;
+ case QStyle::SP_DriveHDIcon: return "harddisk-icon"_L1;
+ case QStyle::SP_DriveCDIcon: return "cd-icon"_L1;
+ case QStyle::SP_DriveDVDIcon: return "dvd-icon"_L1;
+ case QStyle::SP_DriveNetIcon: return "network-icon"_L1;
+ case QStyle::SP_DirOpenIcon: return "directory-open-icon"_L1;
+ case QStyle::SP_DirClosedIcon: return "directory-closed-icon"_L1;
+ case QStyle::SP_DirLinkIcon: return "directory-link-icon"_L1;
+ case QStyle::SP_FileIcon: return "file-icon"_L1;
+ case QStyle::SP_FileLinkIcon: return "file-link-icon"_L1;
+ case QStyle::SP_FileDialogStart: return "filedialog-start-icon"_L1;
+ case QStyle::SP_FileDialogEnd: return "filedialog-end-icon"_L1;
+ case QStyle::SP_FileDialogToParent: return "filedialog-parent-directory-icon"_L1;
+ case QStyle::SP_FileDialogNewFolder: return "filedialog-new-directory-icon"_L1;
+ case QStyle::SP_FileDialogDetailedView: return "filedialog-detailedview-icon"_L1;
+ case QStyle::SP_FileDialogInfoView: return "filedialog-infoview-icon"_L1;
+ case QStyle::SP_FileDialogContentsView: return "filedialog-contentsview-icon"_L1;
+ case QStyle::SP_FileDialogListView: return "filedialog-listview-icon"_L1;
+ case QStyle::SP_FileDialogBack: return "filedialog-backward-icon"_L1;
+ case QStyle::SP_DirIcon: return "directory-icon"_L1;
+ case QStyle::SP_DialogOkButton: return "dialog-ok-icon"_L1;
+ case QStyle::SP_DialogCancelButton: return "dialog-cancel-icon"_L1;
+ case QStyle::SP_DialogHelpButton: return "dialog-help-icon"_L1;
+ case QStyle::SP_DialogOpenButton: return "dialog-open-icon"_L1;
+ case QStyle::SP_DialogSaveButton: return "dialog-save-icon"_L1;
+ case QStyle::SP_DialogCloseButton: return "dialog-close-icon"_L1;
+ case QStyle::SP_DialogApplyButton: return "dialog-apply-icon"_L1;
+ case QStyle::SP_DialogResetButton: return "dialog-reset-icon"_L1;
+ case QStyle::SP_DialogDiscardButton: return "dialog-discard-icon"_L1;
+ case QStyle::SP_DialogYesButton: return "dialog-yes-icon"_L1;
+ case QStyle::SP_DialogNoButton: return "dialog-no-icon"_L1;
+ case QStyle::SP_ArrowUp: return "uparrow-icon"_L1;
+ case QStyle::SP_ArrowDown: return "downarrow-icon"_L1;
+ case QStyle::SP_ArrowLeft: return "leftarrow-icon"_L1;
+ case QStyle::SP_ArrowRight: return "rightarrow-icon"_L1;
+ case QStyle::SP_ArrowBack: return "backward-icon"_L1;
+ case QStyle::SP_ArrowForward: return "forward-icon"_L1;
+ case QStyle::SP_DirHomeIcon: return "home-icon"_L1;
+ case QStyle::SP_LineEditClearButton: return "lineedit-clear-button-icon"_L1;
+ default: return ""_L1;
}
}
@@ -5377,7 +5632,8 @@ QPixmap QStyleSheetStyle::standardPixmap(StandardPixmap standardPixmap, const QS
QRenderRule rule = renderRule(w, opt);
if (rule.hasStyleHint(s)) {
QIcon icon = qvariant_cast<QIcon>(rule.styleHint(s));
- return icon.pixmap(16, 16); // ###: unhard-code this if someone complains
+ const auto dpr = w ? w->devicePixelRatio() : qApp->devicePixelRatio();
+ return icon.pixmap(QSize(16, 16), dpr);
}
}
return baseStyle()->standardPixmap(standardPixmap, opt, w);
@@ -5402,25 +5658,25 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
QRenderRule rule = renderRule(w, opt);
QString s;
switch (sh) {
- case SH_LineEdit_PasswordCharacter: s = QLatin1String("lineedit-password-character"); break;
- case SH_LineEdit_PasswordMaskDelay: s = QLatin1String("lineedit-password-mask-delay"); break;
- case SH_DitherDisabledText: s = QLatin1String("dither-disabled-text"); break;
- case SH_EtchDisabledText: s = QLatin1String("etch-disabled-text"); break;
- case SH_ItemView_ActivateItemOnSingleClick: s = QLatin1String("activate-on-singleclick"); break;
- case SH_ItemView_ShowDecorationSelected: s = QLatin1String("show-decoration-selected"); break;
- case SH_Table_GridLineColor: s = QLatin1String("gridline-color"); break;
- case SH_DialogButtonLayout: s = QLatin1String("button-layout"); break;
- case SH_ToolTipLabel_Opacity: s = QLatin1String("opacity"); break;
- case SH_ComboBox_Popup: s = QLatin1String("combobox-popup"); break;
- case SH_ComboBox_ListMouseTracking: s = QLatin1String("combobox-list-mousetracking"); break;
- case SH_MenuBar_AltKeyNavigation: s = QLatin1String("menubar-altkey-navigation"); break;
- case SH_Menu_Scrollable: s = QLatin1String("menu-scrollable"); break;
- case SH_DrawMenuBarSeparator: s = QLatin1String("menubar-separator"); break;
- case SH_MenuBar_MouseTracking: s = QLatin1String("mouse-tracking"); break;
- case SH_SpinBox_ClickAutoRepeatRate: s = QLatin1String("spinbox-click-autorepeat-rate"); break;
- case SH_SpinControls_DisableOnBounds: s = QLatin1String("spincontrol-disable-on-bounds"); break;
- case SH_MessageBox_TextInteractionFlags: s = QLatin1String("messagebox-text-interaction-flags"); break;
- case SH_ToolButton_PopupDelay: s = QLatin1String("toolbutton-popup-delay"); break;
+ case SH_LineEdit_PasswordCharacter: s = "lineedit-password-character"_L1; break;
+ case SH_LineEdit_PasswordMaskDelay: s = "lineedit-password-mask-delay"_L1; break;
+ case SH_DitherDisabledText: s = "dither-disabled-text"_L1; break;
+ case SH_EtchDisabledText: s = "etch-disabled-text"_L1; break;
+ case SH_ItemView_ActivateItemOnSingleClick: s = "activate-on-singleclick"_L1; break;
+ case SH_ItemView_ShowDecorationSelected: s = "show-decoration-selected"_L1; break;
+ case SH_Table_GridLineColor: s = "gridline-color"_L1; break;
+ case SH_DialogButtonLayout: s = "button-layout"_L1; break;
+ case SH_ToolTipLabel_Opacity: s = "opacity"_L1; break;
+ case SH_ComboBox_Popup: s = "combobox-popup"_L1; break;
+ case SH_ComboBox_ListMouseTracking: s = "combobox-list-mousetracking"_L1; break;
+ case SH_MenuBar_AltKeyNavigation: s = "menubar-altkey-navigation"_L1; break;
+ case SH_Menu_Scrollable: s = "menu-scrollable"_L1; break;
+ case SH_DrawMenuBarSeparator: s = "menubar-separator"_L1; break;
+ case SH_MenuBar_MouseTracking: s = "mouse-tracking"_L1; break;
+ case SH_SpinBox_ClickAutoRepeatRate: s = "spinbox-click-autorepeat-rate"_L1; break;
+ case SH_SpinControls_DisableOnBounds: s = "spincontrol-disable-on-bounds"_L1; break;
+ case SH_MessageBox_TextInteractionFlags: s = "messagebox-text-interaction-flags"_L1; break;
+ case SH_ToolButton_PopupDelay: s = "toolbutton-popup-delay"_L1; break;
case SH_ToolBox_SelectedPageTitleBold:
if (renderRule(w, opt, PseudoElement_ToolBoxTab).hasFont)
return 0;
@@ -5429,12 +5685,12 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
if (rule.hasPalette() && rule.palette()->foreground.style() != Qt::NoBrush)
return rule.palette()->foreground.color().rgba();
break;
- case SH_ScrollView_FrameOnlyAroundContents: s = QLatin1String("scrollview-frame-around-contents"); break;
- case SH_ScrollBar_ContextMenu: s = QLatin1String("scrollbar-contextmenu"); break;
- case SH_ScrollBar_LeftClickAbsolutePosition: s = QLatin1String("scrollbar-leftclick-absolute-position"); break;
- case SH_ScrollBar_MiddleClickAbsolutePosition: s = QLatin1String("scrollbar-middleclick-absolute-position"); break;
- case SH_ScrollBar_RollBetweenButtons: s = QLatin1String("scrollbar-roll-between-buttons"); break;
- case SH_ScrollBar_ScrollWhenPointerLeavesControl: s = QLatin1String("scrollbar-scroll-when-pointer-leaves-control"); break;
+ case SH_ScrollView_FrameOnlyAroundContents: s = "scrollview-frame-around-contents"_L1; break;
+ case SH_ScrollBar_ContextMenu: s = "scrollbar-contextmenu"_L1; break;
+ case SH_ScrollBar_LeftClickAbsolutePosition: s = "scrollbar-leftclick-absolute-position"_L1; break;
+ case SH_ScrollBar_MiddleClickAbsolutePosition: s = "scrollbar-middleclick-absolute-position"_L1; break;
+ case SH_ScrollBar_RollBetweenButtons: s = "scrollbar-roll-between-buttons"_L1; break;
+ case SH_ScrollBar_ScrollWhenPointerLeavesControl: s = "scrollbar-scroll-when-pointer-leaves-control"_L1; break;
case SH_TabBar_Alignment:
#if QT_CONFIG(tabwidget)
if (qobject_cast<const QTabWidget *>(w)) {
@@ -5443,7 +5699,7 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
return rule.position()->position;
}
#endif // QT_CONFIG(tabwidget)
- s = QLatin1String("alignment");
+ s = "alignment"_L1;
break;
#if QT_CONFIG(tabbar)
case SH_TabBar_CloseButtonPosition:
@@ -5457,8 +5713,8 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
}
break;
#endif
- case SH_TabBar_ElideMode: s = QLatin1String("tabbar-elide-mode"); break;
- case SH_TabBar_PreferNoArrows: s = QLatin1String("tabbar-prefer-no-arrows"); break;
+ case SH_TabBar_ElideMode: s = "tabbar-elide-mode"_L1; break;
+ case SH_TabBar_PreferNoArrows: s = "tabbar-prefer-no-arrows"_L1; break;
case SH_ComboBox_PopupFrameStyle:
#if QT_CONFIG(combobox)
if (qobject_cast<const QComboBox *>(w)) {
@@ -5472,8 +5728,8 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
}
#endif // QT_CONFIG(combobox)
break;
- case SH_DialogButtonBox_ButtonsHaveIcons: s = QLatin1String("dialogbuttonbox-buttons-have-icons"); break;
- case SH_Workspace_FillSpaceOnMaximize: s = QLatin1String("mdi-fill-space-on-maximize"); break;
+ case SH_DialogButtonBox_ButtonsHaveIcons: s = "dialogbuttonbox-buttons-have-icons"_L1; break;
+ case SH_Workspace_FillSpaceOnMaximize: s = "mdi-fill-space-on-maximize"_L1; break;
case SH_TitleBar_NoBorder:
if (rule.hasBorder())
return !rule.border()->borders[LeftEdge];
@@ -5484,10 +5740,14 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
return 1;
break;
}
- case SH_ItemView_ArrowKeysNavigateIntoChildren: s = QLatin1String("arrow-keys-navigate-into-children"); break;
- case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: s = QLatin1String("paint-alternating-row-colors-for-empty-area"); break;
- case SH_TitleBar_ShowToolTipsOnButtons: s = QLatin1String("titlebar-show-tooltips-on-buttons"); break;
- case SH_Widget_Animation_Duration: s = QLatin1String("widget-animation-duration"); break;
+ case SH_ItemView_ArrowKeysNavigateIntoChildren: s = "arrow-keys-navigate-into-children"_L1; break;
+ case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: s = "paint-alternating-row-colors-for-empty-area"_L1; break;
+ case SH_TitleBar_ShowToolTipsOnButtons: s = "titlebar-show-tooltips-on-buttons"_L1; break;
+ case SH_Widget_Animation_Duration: s = "widget-animation-duration"_L1; break;
+ case SH_ScrollBar_Transient:
+ if (!rule.hasNativeBorder() || rule.hasBox() || rule.hasDrawable())
+ return 0;
+ break;
default: break;
}
if (!s.isEmpty() && rule.hasStyleHint(s)) {
@@ -5806,14 +6066,14 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
if (hasStyleRule(w, PseudoElement_MdiCloseButton)
|| hasStyleRule(w, PseudoElement_MdiNormalButton)
|| hasStyleRule(w, PseudoElement_MdiMinButton)) {
- QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList();
+ QList<QVariant> layout = rule.styleHint("button-layout"_L1).toList();
if (layout.isEmpty())
- layout = subControlLayout(QLatin1String("mNX"));
+ layout = subControlLayout("mNX");
int x = 0, width = 0;
QRenderRule subRule;
- for (int i = 0; i < layout.count(); i++) {
- int layoutButton = layout[i].toInt();
+ for (const QVariant &val : std::as_const(layout)) {
+ int layoutButton = val.toInt();
if (layoutButton < PseudoElement_MdiCloseButton
|| layoutButton > PseudoElement_MdiNormalButton)
continue;
@@ -5969,8 +6229,22 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
case SE_HeaderLabel: {
QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);
- if (subRule.hasBox() || !subRule.hasNativeBorder())
- return subRule.contentsRect(opt->rect);
+ if (subRule.hasBox() || !subRule.hasNativeBorder()) {
+ auto r = subRule.contentsRect(opt->rect);
+ if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
+ // Subtract width needed for arrow, if there is one
+ if (header->sortIndicator != QStyleOptionHeader::None) {
+ const auto arrowRect = subElementRect(SE_HeaderArrow, opt, w);
+ if (arrowRect.isValid()) {
+ if (opt->state & State_Horizontal)
+ r.setWidth(r.width() - arrowRect.width());
+ else
+ r.setHeight(r.height() - arrowRect.height());
+ }
+ }
+ }
+ return r;
+ }
}
break;
@@ -6059,13 +6333,17 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
case SE_TabBarTabLeftButton:
case SE_TabBarTabRightButton: {
QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);
- if (subRule.hasBox() || !subRule.hasNativeBorder()) {
+ if (subRule.hasBox() || !subRule.hasNativeBorder() || subRule.hasFont) {
if (se == SE_TabBarTabText) {
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
const QTabBar *bar = qobject_cast<const QTabBar *>(w);
const QRect optRect = bar && tab->tabIndex != -1 ? bar->tabRect(tab->tabIndex) : opt->rect;
const QRect r = positionRect(w, subRule, PseudoElement_TabBarTab, optRect, opt->direction);
QStyleOptionTab tabCopy(*tab);
+ if (subRule.hasFont) {
+ const QFont ruleFont = w ? subRule.font.resolve(w->font()) : subRule.font;
+ tabCopy.fontMetrics = QFontMetrics(ruleFont);
+ }
tabCopy.rect = subRule.contentsRect(r);
return ParentStyle::subElementRect(se, &tabCopy, w);
}
@@ -6094,7 +6372,7 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
#endif // QT_CONFIG(toolbar)
// On mac we make pixel adjustments to layouts which are not
- // desireable when you have custom style sheets on them
+ // desirable when you have custom style sheets on them
case SE_CheckBoxLayoutItem:
case SE_ComboBoxLayoutItem:
case SE_DateTimeEditLayoutItem:
@@ -6128,7 +6406,7 @@ void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const
{
// Qt's fontDialog relies on the font of the sample edit for its selection,
// we should never override it.
- if (w->objectName() == QLatin1String("qt_fontDialog_sampleEdit"))
+ if (w->objectName() == "qt_fontDialog_sampleEdit"_L1)
return;
QWidget *container = containerWidget(w);
@@ -6226,7 +6504,7 @@ Qt::Alignment QStyleSheetStyle::resolveAlignment(Qt::LayoutDirection layDir, Qt:
// (and hence has the correct object name).
bool QStyleSheetStyle::isNaturalChild(const QObject *obj)
{
- if (obj->objectName().startsWith(QLatin1String("qt_")))
+ if (obj->objectName().startsWith("qt_"_L1))
return true;
return false;
@@ -6234,6 +6512,9 @@ bool QStyleSheetStyle::isNaturalChild(const QObject *obj)
QPixmap QStyleSheetStyle::loadPixmap(const QString &fileName, const QObject *context)
{
+ if (fileName.isEmpty())
+ return {};
+
qreal ratio = -1.0;
if (const QWidget *widget = qobject_cast<const QWidget *>(context)) {
if (QScreen *screen = QApplication::screenAt(widget->mapToGlobal(QPoint(0, 0))))
diff --git a/src/widgets/styles/qstylesheetstyle_default.cpp b/src/widgets/styles/qstylesheetstyle_default.cpp
index 1cb1adb2db..e50e18f291 100644
--- a/src/widgets/styles/qstylesheetstyle_default.cpp
+++ b/src/widgets/styles/qstylesheetstyle_default.cpp
@@ -1,59 +1,26 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
/* This is the default Qt style sheet.
IMPORTANT: This style sheet is primarily meant for defining feature
- capablities of styles. Do NOT add default styling rules here. When in
+ capabilities of styles. Do NOT add default styling rules here. When in
doubt ask the stylesheet maintainer.
The stylesheet in here used to be in a CSS file, but was moved here to
avoid parsing overhead.
*/
-#include "private/qcssparser_p.h"
#include "qstylesheetstyle_p.h"
+#if QT_CONFIG(cssparser)
+#include "private/qcssparser_p.h"
+#endif
#ifndef QT_NO_STYLE_STYLESHEET
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
using namespace QCss;
// This is the class name of the selector.
@@ -116,7 +83,7 @@ using namespace QCss;
// found among the Value_* constants, in which case the second should be that
// constant. Otherwise the first parameter is Value::Identifier and the second
// is a string.
-// Adding more values is the same as seperating by spaces in CSS.
+// Adding more values is the same as separating by spaces in CSS.
// Ex. border: 2px solid black;
// ^ ^ ^
@@ -164,20 +131,20 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-style-features: background-color;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QLineEdit"));
+ SET_ELEMENT_NAME("QLineEdit"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Base);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Base);
ADD_DECLARATION;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ SET_PROPERTY("-qt-style-features"_L1, QtStyleFeatures);
+ ADD_VALUE(QCss::Value::Identifier, QString::fromLatin1("background-color"));
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -187,13 +154,13 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
border: none;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QLineEdit"));
- ADD_PSEUDO(QLatin1String("no-frame"), PseudoClass_Frameless);
+ SET_ELEMENT_NAME("QLineEdit"_L1);
+ ADD_PSEUDO("no-frame"_L1, PseudoClass_Frameless);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_None);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_None);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -203,12 +170,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
border: native;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QFrame"));
+ SET_ELEMENT_NAME("QFrame"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -219,20 +186,20 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
border-image: none;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QLabel"));
+ SET_ELEMENT_NAME("QLabel"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_ELEMENT_NAME(QLatin1String("QToolBox"));
+ SET_ELEMENT_NAME("QToolBox"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("background"), Background);
- ADD_VALUE(Value::KnownIdentifier, Value_None);
+ SET_PROPERTY("background"_L1, Background);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_None);
ADD_DECLARATION;
- SET_PROPERTY(QLatin1String("border-image"), BorderImage);
- ADD_VALUE(Value::KnownIdentifier, Value_None);
+ SET_PROPERTY("border-image"_L1, BorderImage);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_None);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -242,12 +209,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
border: native;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QGroupBox"));
+ SET_ELEMENT_NAME("QGroupBox"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -259,16 +226,16 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
border: native;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QToolTip"));
+ SET_ELEMENT_NAME("QToolTip"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Window);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Window);
ADD_DECLARATION;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -279,21 +246,21 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-style-features: background-color; //only for not pixmap based styles
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QPushButton"));
+ SET_ELEMENT_NAME("QPushButton"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_ELEMENT_NAME(QLatin1String("QToolButton"));
+ SET_ELEMENT_NAME("QToolButton"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("border-style"), BorderStyles);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border-style"_L1, BorderStyles);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
if (!styleIsPixmapBased) {
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ SET_PROPERTY("-qt-style-features"_L1, QtStyleFeatures);
+ ADD_VALUE(QCss::Value::Identifier, QString::fromLatin1("background-color"));
ADD_DECLARATION;
}
@@ -309,23 +276,23 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QComboBox"));
+ SET_ELEMENT_NAME("QComboBox"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
if (!styleIsPixmapBased) {
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-gradient"));
+ SET_PROPERTY("-qt-style-features"_L1, QtStyleFeatures);
+ ADD_VALUE(QCss::Value::Identifier, QString::fromLatin1("background-color"));
+ ADD_VALUE(QCss::Value::Identifier, QString::fromLatin1("background-gradient"));
ADD_DECLARATION;
}
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Base);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Base);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -339,13 +306,13 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
}*/
if (baseStyle()->inherits("QPlastiqueStyle") || baseStyle()->inherits("QCleanlooksStyle") || baseStyle()->inherits("QFusionStyle"))
{
- SET_ELEMENT_NAME(QLatin1String("QComboBox"));
- ADD_ATTRIBUTE_SELECTOR(QLatin1String("readOnly"), QLatin1String("true"), AttributeSelector::MatchEqual);
+ SET_ELEMENT_NAME("QComboBox"_L1);
+ ADD_ATTRIBUTE_SELECTOR("readOnly"_L1, "true"_L1, AttributeSelector::MatchEqual);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Button);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Button);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -357,20 +324,20 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-background-role: base;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QAbstractSpinBox"));
+ SET_ELEMENT_NAME("QAbstractSpinBox"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ SET_PROPERTY("-qt-style-features"_L1, QtStyleFeatures);
+ ADD_VALUE(QCss::Value::Identifier, QString::fromLatin1("background-color"));
ADD_DECLARATION;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Base);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Base);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -380,12 +347,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-background-role: window;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QMenu"));
+ SET_ELEMENT_NAME("QMenu"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Window);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Window);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -394,13 +361,13 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-style-features: background-color;
}*/
if (!styleIsPixmapBased) {
- SET_ELEMENT_NAME(QLatin1String("QMenu"));
- ADD_PSEUDO(QLatin1String("item"), PseudoClass_Unknown);
+ SET_ELEMENT_NAME("QMenu"_L1);
+ ADD_PSEUDO("item"_L1, PseudoClass_Unknown);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ SET_PROPERTY("-qt-style-features"_L1, QtStyleFeatures);
+ ADD_VALUE(QCss::Value::Identifier, QString::fromLatin1("background-color"));
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -410,12 +377,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-background-role: window;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QHeaderView"));
+ SET_ELEMENT_NAME("QHeaderView"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Window);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Window);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -427,28 +394,28 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
border: native;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QTableCornerButton"));
- ADD_PSEUDO(QLatin1String("section"), PseudoClass_Unknown);
+ SET_ELEMENT_NAME("QTableCornerButton"_L1);
+ ADD_PSEUDO("section"_L1, PseudoClass_Unknown);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_ELEMENT_NAME(QLatin1String("QHeaderView"));
- ADD_PSEUDO(QLatin1String("section"), PseudoClass_Unknown);
+ SET_ELEMENT_NAME("QHeaderView"_L1);
+ ADD_PSEUDO("section"_L1, PseudoClass_Unknown);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Button);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Button);
ADD_DECLARATION;
if (!styleIsPixmapBased) {
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ SET_PROPERTY("-qt-style-features"_L1, QtStyleFeatures);
+ ADD_VALUE(QCss::Value::Identifier, QString::fromLatin1("background-color"));
ADD_DECLARATION;
}
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -458,12 +425,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-background-role: base;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QProgressBar"));
+ SET_ELEMENT_NAME("QProgressBar"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Base);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Base);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -473,12 +440,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
-qt-background-role: window;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QScrollBar"));
+ SET_ELEMENT_NAME("QScrollBar"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
- ADD_VALUE(Value::KnownIdentifier, Value_Window);
+ SET_PROPERTY("-qt-background-role"_L1, QtBackgroundRole);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Window);
ADD_DECLARATION;
ADD_STYLE_RULE;
@@ -488,12 +455,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
border: native;
}*/
{
- SET_ELEMENT_NAME(QLatin1String("QDockWidget"));
+ SET_ELEMENT_NAME("QDockWidget"_L1);
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("border"), Border);
- ADD_VALUE(Value::KnownIdentifier, Value_Native);
+ SET_PROPERTY("border"_L1, Border);
+ ADD_VALUE(QCss::Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
ADD_STYLE_RULE;
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index fa8a0955a7..95d9db19c9 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTYLESHEETSTYLE_P_H
#define QSTYLESHEETSTYLE_P_H
@@ -169,6 +133,8 @@ private:
static bool isNaturalChild(const QObject *obj);
static QPixmap loadPixmap(const QString &fileName, const QObject *context);
bool initObject(const QObject *obj) const;
+ void renderMenuItemIcon(const QStyleOptionMenuItem *mi, QPainter *p, const QWidget *w,
+ const QRect &rect, QRenderRule &subRule) const;
public:
static int numinstances;
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index e6198540a3..bae182b467 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwindowsstyle_p.h"
#include "qwindowsstyle_p_p.h"
@@ -124,26 +88,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
QWindowsStylePrivate::QWindowsStylePrivate() = default;
-qreal QWindowsStylePrivate::appDevicePixelRatio()
-{
- return qApp->devicePixelRatio();
-}
-
-bool QWindowsStylePrivate::isDarkMode()
-{
- bool result = false;
-#ifdef Q_OS_WIN
- using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
- // Windows only: Return whether dark mode style support is desired and
- // dark mode is in effect.
- if (auto windowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
- result = windowsApp->isDarkMode()
- && windowsApp->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle);
- }
-#endif
- return result;
-}
-
// Returns \c true if the toplevel parent of \a widget has seen the Alt-key
bool QWindowsStylePrivate::hasSeenAlt(const QWidget *widget) const
{
@@ -168,19 +112,20 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
widget = widget->window();
// Alt has been pressed - find all widgets that care
- QList<QWidget *> l = widget->findChildren<QWidget *>();
+ const QList<QWidget *> children = widget->findChildren<QWidget *>();
auto ignorable = [](QWidget *w) {
return w->isWindow() || !w->isVisible()
|| w->style()->styleHint(SH_UnderlineShortcut, nullptr, w);
};
- l.removeIf(ignorable);
// Update states before repainting
d->seenAlt.append(widget);
d->alt_down = true;
// Repaint all relevant widgets
- for (int pos = 0; pos < l.size(); ++pos)
- l.at(pos)->update();
+ for (QWidget *w : children) {
+ if (!ignorable(w))
+ w->update();
+ }
}
break;
case QEvent::KeyRelease:
@@ -190,9 +135,9 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
// Update state and repaint the menu bars.
d->alt_down = false;
#if QT_CONFIG(menubar)
- QList<QMenuBar *> l = widget->findChildren<QMenuBar *>();
- for (int i = 0; i < l.size(); ++i)
- l.at(i)->update();
+ const QList<QMenuBar *> menuBars = widget->findChildren<QMenuBar *>();
+ for (QWidget *w : menuBars)
+ w->update();
#endif
}
break;
@@ -312,28 +257,33 @@ void QWindowsStyle::polish(QPalette &pal)
int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *, const QWidget *widget)
{
#if defined(Q_OS_WIN)
+ // The pixel metrics are in device indepentent pixels;
+ // hardcode DPI to 1x 96 DPI.
+ const int dpi = 96;
+
switch (pm) {
case QStyle::PM_DockWidgetFrameWidth:
- return GetSystemMetrics(SM_CXFRAME);
-
- case QStyle::PM_TitleBarHeight:
- if (widget && (widget->windowType() == Qt::Tool)) {
- // MS always use one less than they say
- return GetSystemMetrics(SM_CYSMCAPTION) - 1;
- }
- return GetSystemMetrics(SM_CYCAPTION) - 1;
+ return GetSystemMetricsForDpi(SM_CXFRAME, dpi);
+
+ case QStyle::PM_TitleBarHeight: {
+ const int resizeBorderThickness =
+ GetSystemMetricsForDpi(SM_CXSIZEFRAME, dpi) + GetSystemMetricsForDpi(SM_CXPADDEDBORDER, dpi);
+ if (widget && (widget->windowType() == Qt::Tool))
+ return GetSystemMetricsForDpi(SM_CYSMCAPTION, dpi) + resizeBorderThickness;
+ return GetSystemMetricsForDpi(SM_CYCAPTION, dpi) + resizeBorderThickness;
+ }
case QStyle::PM_ScrollBarExtent:
{
NONCLIENTMETRICS ncm;
- ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
- if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))
+ ncm.cbSize = sizeof(NONCLIENTMETRICS);
+ if (SystemParametersInfoForDpi(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0, dpi))
return qMax(ncm.iScrollHeight, ncm.iScrollWidth);
}
break;
case QStyle::PM_MdiSubWindowFrameWidth:
- return GetSystemMetrics(SM_CYFRAME);
+ return GetSystemMetricsForDpi(SM_CYFRAME, dpi);
default:
break;
@@ -405,22 +355,10 @@ static QScreen *screenOf(const QWidget *w)
}
// Calculate the overall scale factor to obtain Qt Device Independent
-// Pixels from a native Windows size. Divide by devicePixelRatio
-// and account for secondary screens with differing logical DPI.
+// Pixels from a native Windows size.
qreal QWindowsStylePrivate::nativeMetricScaleFactor(const QWidget *widget)
{
- qreal result = qreal(1) / QWindowsStylePrivate::devicePixelRatio(widget);
- if (QGuiApplicationPrivate::screen_list.size() > 1) {
- const QScreen *primaryScreen = QGuiApplication::primaryScreen();
- const QScreen *screen = screenOf(widget);
- if (screen != primaryScreen) {
- const qreal primaryLogicalDpi = primaryScreen->handle()->logicalDpi().first;
- const qreal logicalDpi = screen->handle()->logicalDpi().first;
- if (!qFuzzyCompare(primaryLogicalDpi, logicalDpi))
- result *= logicalDpi / primaryLogicalDpi;
- }
- }
- return result;
+ return qreal(1) / QHighDpiScaling::factor(screenOf(widget));
}
/*!
@@ -430,7 +368,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
{
int ret = QWindowsStylePrivate::pixelMetricFromSystemDp(pm, opt, widget);
if (ret != QWindowsStylePrivate::InvalidMetric)
- return qRound(qreal(ret) * QWindowsStylePrivate::nativeMetricScaleFactor(widget));
+ return ret;
ret = QWindowsStylePrivate::fixedPixelMetric(pm);
if (ret != QWindowsStylePrivate::InvalidMetric)
@@ -440,7 +378,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
switch (pm) {
case PM_MaximumDragDistance:
- ret = QCommonStyle::pixelMetric(PM_MaximumDragDistance);
+ ret = QCommonStyle::pixelMetric(PM_MaximumDragDistance, opt, widget);
if (ret == -1)
ret = 60;
break;
@@ -497,46 +435,6 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
const QWidget *widget) const
{
-#if defined(Q_OS_WIN)
- QPixmap desktopIcon;
- switch(standardPixmap) {
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- case SP_DriveNetIcon:
- case SP_DriveHDIcon:
- case SP_DriveFDIcon:
- case SP_FileIcon:
- case SP_FileLinkIcon:
- case SP_DirLinkIcon:
- case SP_DirClosedIcon:
- case SP_DesktopIcon:
- case SP_ComputerIcon:
- case SP_DirOpenIcon:
- case SP_FileDialogNewFolder:
- case SP_DirHomeIcon:
- case SP_TrashIcon:
- case SP_VistaShield:
- if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
- QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardPixmap);
- desktopIcon = theme->standardPixmap(sp, QSizeF(16, 16));
- }
- break;
- case SP_MessageBoxInformation:
- case SP_MessageBoxWarning:
- case SP_MessageBoxCritical:
- case SP_MessageBoxQuestion:
- if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
- QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardPixmap);
- desktopIcon = theme->standardPixmap(sp, QSizeF());
- }
- break;
- default:
- break;
- }
- if (!desktopIcon.isNull()) {
- return desktopIcon;
- }
-#endif // Q_OS_WIN
return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
}
@@ -547,9 +445,14 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
int ret = 0;
switch (hint) {
- case SH_EtchDisabledText:
- ret = d_func()->isDarkMode() ? 0 : 1;
+ case SH_EtchDisabledText: {
+ const QPalette pal = opt ? opt->palette
+ : widget ? widget->palette()
+ : QPalette();
+ ret = pal.window().color().lightness() > pal.text().color().lightness()
+ ? 1 : 0;
break;
+ }
case SH_Slider_SnapToValue:
case SH_PrintDialog_RightAlignButtons:
case SH_FontDialog_SelectAssociatedText:
@@ -604,12 +507,12 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
ret = 1;
}
}
-#ifndef QT_NO_ACCESSIBILITY
+#if QT_CONFIG(accessibility)
if (!ret && opt && opt->type == QStyleOption::SO_MenuItem
&& QStyleHelper::isInstanceOf(opt->styleObject, QAccessible::MenuItem)
&& opt->styleObject->property("_q_showUnderlined").toBool())
ret = 1;
-#endif // QT_NO_ACCESSIBILITY
+#endif // QT_CONFIG(accessibility)
break;
}
#endif // Q_OS_WIN
@@ -853,7 +756,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
}
#endif // QT_CONFIG(itemviews)
if (!(opt->state & State_Off)) {
- QPointF points[6];
+ std::array<QPointF, 6> points;
qreal scaleh = opt->rect.width() / 12.0;
qreal scalev = opt->rect.height() / 12.0;
points[0] = { opt->rect.x() + qreal(3.5) * scaleh, opt->rect.y() + qreal(5.5) * scalev };
@@ -864,7 +767,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
points[5] = { points[4].x() - 4 * scaleh, points[4].y() + 4 * scalev };
p->setPen(QPen(opt->palette.text().color(), 0));
p->setBrush(opt->palette.text().color());
- p->drawPolygon(points, 6);
+ p->drawPolygon(points.data(), static_cast<int>(points.size()));
}
if (doRestore)
p->restore();
@@ -1157,9 +1060,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
else
pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode);
- const int pixw = pixmap.width() / pixmap.devicePixelRatio();
- const int pixh = pixmap.height() / pixmap.devicePixelRatio();
- QRect pmr(0, 0, pixw, pixh);
+ QRect pmr(QPoint(0, 0), pixmap.deviceIndependentSize().toSize());
pmr.moveCenter(vCheckRect.center());
p->setPen(menuitem->palette.text().color());
p->drawPixmap(pmr.topLeft(), pixmap);
@@ -1169,7 +1070,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
if (!dis)
newMi.state |= State_Enabled;
if (act)
- newMi.state |= State_On;
+ newMi.state |= State_On | State_Selected;
newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + QWindowsStylePrivate::windowsItemFrame,
menuitem->rect.y() + QWindowsStylePrivate::windowsItemFrame,
checkcol - 2 * QWindowsStylePrivate::windowsItemFrame,
@@ -1192,7 +1093,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
QStringView s(menuitem->text);
if (!s.isEmpty()) { // draw text
p->save();
- int t = s.indexOf(QLatin1Char('\t'));
+ qsizetype t = s.indexOf(u'\t');
int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
text_flags |= Qt::TextHideMnemonic;
@@ -1618,11 +1519,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
default:
break;
}
- if (opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end
- bool tmp = paintLeftBorder;
- paintRightBorder=paintLeftBorder;
- paintLeftBorder=tmp;
- }
+ if (opt->direction == Qt::RightToLeft) //reverse layout changes the order of Beginning/end
+ std::swap(paintLeftBorder, paintRightBorder);
break;
case Qt::RightToolBarArea :
switch (toolbar->positionOfLine){
@@ -1834,7 +1732,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
titleRect.height(), titleRect.width());
}
proxy()->drawItemText(p, titleRect,
- Qt::AlignLeft | Qt::AlignVCenter, palette,
+ Qt::AlignLeft | Qt::AlignVCenter | Qt::TextHideMnemonic, palette,
dwOpt->state & State_Enabled, dwOpt->title,
floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);
p->setFont(oldFont);
@@ -1997,39 +1895,36 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
QSliderDirection dir;
if (orient == Qt::Horizontal)
- if (tickAbove)
- dir = SlUp;
- else
- dir = SlDown;
+ dir = tickAbove ? SlUp : SlDown;
else
- if (tickAbove)
- dir = SlLeft;
- else
- dir = SlRight;
-
- QPolygon a;
+ dir = tickAbove ? SlLeft : SlRight;
+ std::array<QPoint, 5> points;
int d = 0;
switch (dir) {
case SlUp:
- y1 = y1 + wi/2;
+ y1 = y1 + wi / 2;
d = (wi + 1) / 2 - 1;
- a.setPoints(5, x1,y1, x1,y2, x2,y2, x2,y1, x1+d,y1-d);
+ points = {QPoint(x1, y1), QPoint(x1, y2), QPoint(x2, y2),
+ QPoint(x2, y1), QPoint(x1 + d, y1 - d)};
break;
case SlDown:
- y2 = y2 - wi/2;
+ y2 = y2 - wi / 2;
d = (wi + 1) / 2 - 1;
- a.setPoints(5, x1,y1, x1,y2, x1+d,y2+d, x2,y2, x2,y1);
+ points = {QPoint(x1, y1), QPoint(x1, y2), QPoint(x1 + d, y2 + d),
+ QPoint(x2, y2), QPoint(x2, y1)};
break;
case SlLeft:
d = (he + 1) / 2 - 1;
- x1 = x1 + he/2;
- a.setPoints(5, x1,y1, x1-d,y1+d, x1,y2, x2,y2, x2,y1);
+ x1 = x1 + he / 2;
+ points = {QPoint(x1, y1), QPoint(x1 - d, y1 + d), QPoint(x1,y2),
+ QPoint(x2, y2), QPoint(x2, y1)};
break;
case SlRight:
d = (he + 1) / 2 - 1;
- x2 = x2 - he/2;
- a.setPoints(5, x1,y1, x1,y2, x2,y2, x2+d,y1+d, x2,y1);
+ x2 = x2 - he / 2;
+ points = {QPoint(x1, y1), QPoint(x1, y2), QPoint(x2, y2),
+ QPoint(x2 + d, y1 + d), QPoint(x2, y1)};
break;
}
@@ -2039,7 +1934,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
Qt::BGMode oldMode = p->backgroundMode();
p->setBackgroundMode(Qt::OpaqueMode);
p->drawRect(x1, y1, x2-x1+1, y2-y1+1);
- p->drawPolygon(a);
+ p->drawPolygon(points.data(), static_cast<int>(points.size()));
p->setBrush(oldBrush);
p->setBackgroundMode(oldMode);
@@ -2350,7 +2245,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
int maxpmw = mi->maxIconWidth;
int tabSpacing = 20;
- if (mi->text.contains(QLatin1Char('\t')))
+ if (mi->text.contains(u'\t'))
w += tabSpacing;
else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu)
w += 2 * QWindowsStylePrivate::windowsArrowHMargin;
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index b5f0bd68a1..2c2ca0c76b 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWSSTYLE_P_H
#define QWINDOWSSTYLE_P_H
diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h
index ee71b3e00a..dce60cbf8d 100644
--- a/src/widgets/styles/qwindowsstyle_p_p.h
+++ b/src/widgets/styles/qwindowsstyle_p_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWINDOWSSTYLE_P_P_H
#define QWINDOWSSTYLE_P_P_H
@@ -60,8 +24,6 @@
QT_BEGIN_NAMESPACE
-class QTime;
-
class Q_WIDGETS_EXPORT QWindowsStylePrivate : public QCommonStylePrivate
{
Q_DECLARE_PUBLIC(QWindowsStyle)
@@ -71,16 +33,12 @@ public:
QWindowsStylePrivate();
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option = nullptr, const QWidget *widget = nullptr);
static int fixedPixelMetric(QStyle::PixelMetric pm);
- static qreal devicePixelRatio(const QWidget *widget = nullptr)
- { return widget ? widget->devicePixelRatio() : QWindowsStylePrivate::appDevicePixelRatio(); }
static qreal nativeMetricScaleFactor(const QWidget *widget = nullptr);
- static bool isDarkMode();
bool hasSeenAlt(const QWidget *widget) const;
bool altDown() const { return alt_down; }
bool alt_down = false;
QList<const QWidget *> seenAlt;
- int menuBarTimer = 0;
QColor inactiveCaptionText;
QColor activeCaptionColor;
@@ -97,9 +55,6 @@ public:
windowsRightBorder = 15, // right border on windows
windowsCheckMarkWidth = 12 // checkmarks width on windows
};
-
-private:
- static qreal appDevicePixelRatio();
};
QT_END_NAMESPACE