Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Simplify the squeezed combobox a little, add better size icons, fix potential error message.

Wolthera van Hövell tot Westerflier69150861f542
diff --git a/pics/16_dark_format-text-direction-horizontal-tb.svg b/pics/16_dark_format-text-direction-horizontal-tb.svg
new file mode 100644
index 0000000000..7e0b045c57
--- /dev/null
+++ b/pics/16_dark_format-text-direction-horizontal-tb.svg
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg6"
+ sodipodi:docname="16_dark_format-text-direction-horizontal.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview8"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="7.4915254"
+ inkscape:cy="8"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#373737;fill-opacity:1;stroke:none"
+ d="M 4.6875 3 L 2 10 L 2.84375 10 L 3.6875 7.78125 L 6.46875 7.78125 L 7.28125 10 L 8.125 10 L 5.53125 3 L 4.6875 3 z M 7 3 L 7 4 L 11 4 L 11 3 L 7 3 z M 12 3 L 12 7 L 14 5 L 12 3 z M 5.09375 3.84375 C 5.16302 4.08307 5.52308 5.16349 6.1875 7.09375 L 3.9375 7.09375 L 5.09375 3.84375 z M 8 6 L 8 7 L 11 7 L 11 6 L 8 6 z M 9 9 L 9 10 L 11 10 L 11 9 L 9 9 z M 12 9 L 12 13 L 14 11 L 12 9 z M 2 12 L 2 13 L 11 13 L 11 12 L 2 12 z "
+ class="ColorScheme-Text"
+ id="path4" />
+</svg>
diff --git a/pics/16_dark_format-text-direction-ltr.svg b/pics/16_dark_format-text-direction-ltr.svg
new file mode 100644
index 0000000000..9298a875ac
--- /dev/null
+++ b/pics/16_dark_format-text-direction-ltr.svg
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg8827"
+ sodipodi:docname="16_dark_format-text-direction-ltr.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview8829"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="7.4915254"
+ inkscape:cy="8"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8827" />
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#373737;fill-opacity:1;stroke:none"
+ d="M 2 2 L 2 6 L 6 6 L 6 2 L 2 2 z M 7 2 L 7 3 L 14 3 L 14 2 L 7 2 z M 7 4 L 7 5 L 9 5 L 9 4 L 7 4 z M 2 7 L 2 8 L 12 8 L 12 7 L 2 7 z M 2 9 L 2 10 L 7 10 L 7 9 L 2 9 z M 2 12 L 2 13 L 10 13 L 10 12 L 2 12 z M 12 13 L 12 14 L 14 14 L 14 13 L 12 13 z "
+ class="ColorScheme-Text"
+ id="path8825" />
+</svg>
diff --git a/pics/16_dark_format-text-direction-vertical-lr.svg b/pics/16_dark_format-text-direction-vertical-lr.svg
new file mode 100644
index 0000000000..0d708c5013
--- /dev/null
+++ b/pics/16_dark_format-text-direction-vertical-lr.svg
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg6641"
+ sodipodi:docname="16_dark_format-text-direction-vertical-lr.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview6643"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="7.4915254"
+ inkscape:cy="8"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6641" />
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#373737;fill-opacity:1;stroke:none"
+ d="M 4.625 2 L 2 9 L 2.8125 9 L 3.65625 6.78125 L 6.375 6.78125 L 7.1875 9 L 8 9 L 5.4375 2 L 4.625 2 z M 9 2 L 9 11 L 10 11 L 10 2 L 9 2 z M 12 2 L 12 11 L 13 11 L 13 2 L 12 2 z M 5.03125 2.84375 C 5.09915 3.08307 5.47376 4.16349 6.125 6.09375 L 3.90625 6.09375 L 5.03125 2.84375 z M 3 10 L 3 11 L 4 11 L 4 10 L 3 10 z M 6 10 L 6 11 L 7 11 L 7 10 L 6 10 z M 3 12 L 5 14 L 7 12 L 3 12 z M 9 12 L 11 14 L 13 12 L 9 12 z "
+ class="ColorScheme-Text"
+ id="path6639" />
+</svg>
diff --git a/pics/16_dark_format-text-direction-vertical-rl.svg b/pics/16_dark_format-text-direction-vertical-rl.svg
new file mode 100644
index 0000000000..44d5d4a3f6
--- /dev/null
+++ b/pics/16_dark_format-text-direction-vertical-rl.svg
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg6641"
+ sodipodi:docname="16_dark_format-text-direction-vertical-rl.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview6643"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="true"
+ inkscape:zoom="41.7193"
+ inkscape:cx="7.5864168"
+ inkscape:cy="8.005887"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6641">
+ <inkscape:grid
+ type="xygrid"
+ id="grid8756" />
+ </sodipodi:namedview>
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#373737;fill-opacity:1;stroke:none"
+ d="M 11.375,2 14,9 H 13.1875 L 12.34375,6.78125 H 9.625 L 8.8125,9 H 8 L 10.5625,2 Z M 7,2 v 9 H 6 V 2 Z M 4,2 v 9 H 3 V 2 Z m 6.96875,0.84375 c -0.0679,0.23932 -0.44251,1.31974 -1.09375,3.25 h 2.21875 z M 13,10 v 1 h -1 v -1 z m -3,0 v 1 H 9 v -1 z m 3,2 -2,2 -2,-2 z M 7,12 5,14 3,12 Z"
+ class="ColorScheme-Text"
+ id="path6639" />
+</svg>
diff --git a/pics/16_light_format-text-direction-horizontal-tb.svg b/pics/16_light_format-text-direction-horizontal-tb.svg
new file mode 100644
index 0000000000..936a600bf7
--- /dev/null
+++ b/pics/16_light_format-text-direction-horizontal-tb.svg
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg6"
+ sodipodi:docname="16_light_format-text-direction-horizontal.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview8"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="7.4915254"
+ inkscape:cy="8"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6" />
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#d2d2d2;fill-opacity:1;stroke:none"
+ d="M 4.6875 3 L 2 10 L 2.84375 10 L 3.6875 7.78125 L 6.46875 7.78125 L 7.28125 10 L 8.125 10 L 5.53125 3 L 4.6875 3 z M 7 3 L 7 4 L 11 4 L 11 3 L 7 3 z M 12 3 L 12 7 L 14 5 L 12 3 z M 5.09375 3.84375 C 5.16302 4.08307 5.52308 5.16349 6.1875 7.09375 L 3.9375 7.09375 L 5.09375 3.84375 z M 8 6 L 8 7 L 11 7 L 11 6 L 8 6 z M 9 9 L 9 10 L 11 10 L 11 9 L 9 9 z M 12 9 L 12 13 L 14 11 L 12 9 z M 2 12 L 2 13 L 11 13 L 11 12 L 2 12 z "
+ class="ColorScheme-Text"
+ id="path4" />
+</svg>
diff --git a/pics/16_light_format-text-direction-ltr.svg b/pics/16_light_format-text-direction-ltr.svg
new file mode 100644
index 0000000000..5d57f2364d
--- /dev/null
+++ b/pics/16_light_format-text-direction-ltr.svg
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg8827"
+ sodipodi:docname="16_light_format-text-direction-ltr.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview8829"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="false"
+ inkscape:zoom="14.75"
+ inkscape:cx="7.4915254"
+ inkscape:cy="8"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg8827" />
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#d2d2d2;fill-opacity:1;stroke:none"
+ d="M 2 2 L 2 6 L 6 6 L 6 2 L 2 2 z M 7 2 L 7 3 L 14 3 L 14 2 L 7 2 z M 7 4 L 7 5 L 9 5 L 9 4 L 7 4 z M 2 7 L 2 8 L 12 8 L 12 7 L 2 7 z M 2 9 L 2 10 L 7 10 L 7 9 L 2 9 z M 2 12 L 2 13 L 10 13 L 10 12 L 2 12 z M 12 13 L 12 14 L 14 14 L 14 13 L 12 13 z "
+ class="ColorScheme-Text"
+ id="path8825" />
+</svg>
diff --git a/pics/16_light_format-text-direction-vertical-lr.svg b/pics/16_light_format-text-direction-vertical-lr.svg
new file mode 100644
index 0000000000..6f4a19e8fe
--- /dev/null
+++ b/pics/16_light_format-text-direction-vertical-lr.svg
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg6641"
+ sodipodi:docname="16_light_format-text-direction-vertical-lr.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview6643"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="true"
+ inkscape:zoom="41.7193"
+ inkscape:cx="7.5864168"
+ inkscape:cy="8.005887"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6641" />
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#d2d2d2;fill-opacity:1;stroke:none"
+ d="M 4.625 2 L 2 9 L 2.8125 9 L 3.65625 6.78125 L 6.375 6.78125 L 7.1875 9 L 8 9 L 5.4375 2 L 4.625 2 z M 9 2 L 9 11 L 10 11 L 10 2 L 9 2 z M 12 2 L 12 11 L 13 11 L 13 2 L 12 2 z M 5.03125 2.84375 C 5.09915 3.08307 5.47376 4.16349 6.125 6.09375 L 3.90625 6.09375 L 5.03125 2.84375 z M 3 10 L 3 11 L 4 11 L 4 10 L 3 10 z M 6 10 L 6 11 L 7 11 L 7 10 L 6 10 z M 3 12 L 5 14 L 7 12 L 3 12 z M 9 12 L 11 14 L 13 12 L 9 12 z "
+ class="ColorScheme-Text"
+ id="path6639" />
+</svg>
diff --git a/pics/16_light_format-text-direction-vertical-rl.svg b/pics/16_light_format-text-direction-vertical-rl.svg
new file mode 100644
index 0000000000..803c9692cb
--- /dev/null
+++ b/pics/16_light_format-text-direction-vertical-rl.svg
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ viewBox="0 0 16 16"
+ version="1.1"
+ id="svg6641"
+ sodipodi:docname="16_light_format-text-direction-vertical-rl.svg"
+ inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:svg="http://www.w3.org/2000/svg">
+ <sodipodi:namedview
+ id="namedview6643"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:showpageshadow="2"
+ inkscape:pageopacity="0.0"
+ inkscape:pagecheckerboard="0"
+ inkscape:deskcolor="#d1d1d1"
+ showgrid="true"
+ inkscape:zoom="41.7193"
+ inkscape:cx="7.5864168"
+ inkscape:cy="8.005887"
+ inkscape:window-width="1920"
+ inkscape:window-height="1010"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg6641">
+ <inkscape:grid
+ type="xygrid"
+ id="grid8756" />
+ </sodipodi:namedview>
+ <defs
+ id="defs3051">
+ <style
+ type="text/css"
+ id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path
+ style="fill:#d2d2d2;fill-opacity:1;stroke:none"
+ d="M 11.375,2 14,9 H 13.1875 L 12.34375,6.78125 H 9.625 L 8.8125,9 H 8 L 10.5625,2 Z M 7,2 v 9 H 6 V 2 Z M 4,2 v 9 H 3 V 2 Z m 6.96875,0.84375 c -0.0679,0.23932 -0.44251,1.31974 -1.09375,3.25 h 2.21875 z M 13,10 v 1 h -1 v -1 z m -3,0 v 1 H 9 v -1 z m 3,2 -2,2 -2,-2 z M 7,12 5,14 3,12 Z"
+ class="ColorScheme-Text"
+ id="path6639" />
+</svg>
diff --git a/pics/icons.qrc b/pics/icons.qrc
index ede7b6d9ad..930bf55311 100644
--- a/pics/icons.qrc
+++ b/pics/icons.qrc
@@ -321,5 +321,13 @@
<file>22_dark_format-text-direction-horizontal-tb.svg</file>
<file>22_dark_format-text-direction-ltr.svg</file>
<file>22_light_format-text-direction-ltr.svg</file>
+ <file>16_light_format-text-direction-vertical-lr.svg</file>
+ <file>16_light_format-text-direction-vertical-rl.svg</file>
+ <file>16_light_format-text-direction-horizontal-tb.svg</file>
+ <file>16_dark_format-text-direction-vertical-lr.svg</file>
+ <file>16_dark_format-text-direction-vertical-rl.svg</file>
+ <file>16_dark_format-text-direction-horizontal-tb.svg</file>
+ <file>16_dark_format-text-direction-ltr.svg</file>
+ <file>16_light_format-text-direction-ltr.svg</file>
</qresource>
</RCC>
diff --git a/plugins/dockers/textproperties/qml/Direction.qml b/plugins/dockers/textproperties/qml/Direction.qml
index 23f3a30697..786ad9a061 100644
--- a/plugins/dockers/textproperties/qml/Direction.qml
+++ b/plugins/dockers/textproperties/qml/Direction.qml
@@ -69,13 +69,13 @@ TextPropertyBase {
Layout.fillWidth: true;
Layout.preferredWidth: implicitWidth;
model: [
- {text: i18nc("@label:inlistbox", "Left to Right"), value: KoSvgText.DirectionLeftToRight, icon: "qrc:///22_light_format-text-direction-ltr.svg"},
- {text: i18nc("@label:inlistbox", "Right to Left"), value: KoSvgText.DirectionRightToLeft, icon: "qrc:///22_light_format-text-direction-rtl.svg"}
+ {text: i18nc("@label:inlistbox", "Left to Right"), value: KoSvgText.DirectionLeftToRight, icon: "qrc:///16_light_format-text-direction-ltr.svg"},
+ {text: i18nc("@label:inlistbox", "Right to Left"), value: KoSvgText.DirectionRightToLeft, icon: "qrc:///16_light_format-text-direction-rtl.svg"}
]
textRole: "text";
valueRole: "value";
iconRole: "icon";
- iconSize: 22;
+ iconSize: 16;
onActivated: direction = currentValue;
wheelEnabled: true;
PaletteControl {
diff --git a/plugins/dockers/textproperties/qml/SqueezedComboBox.qml b/plugins/dockers/textproperties/qml/SqueezedComboBox.qml
index fd3a6754a6..4f6d4fb677 100644
--- a/plugins/dockers/textproperties/qml/SqueezedComboBox.qml
+++ b/plugins/dockers/textproperties/qml/SqueezedComboBox.qml
@@ -31,7 +31,7 @@ ComboBox {
icon.width: squeezedComboBox.iconSize;
icon.color: highlighted? palette.highlightedText: palette.text;
icon.source: squeezedComboBox.iconRole && mData !== undefined ? mData[squeezedComboBox.iconRole] : "";
- text: squeezedComboBox.textRole && mData !== undefined? mData[squeezedComboBox.textRole] : "";
+ text: squeezedComboBox.displayText;
background: Rectangle{ color:"transparent";}
@@ -43,37 +43,20 @@ ComboBox {
}
}
- TextMetrics {
- id: textMetrics;
- font: contentItemDelegate.font;
- }
-
// It is surprisingly hard to get the listview to be the same size as the child rect, if we also want the children
// to grow if there's any more space. This function calculates that.
- function recalculatePopupWidth() {
- if (model === undefined) return;
- let maxValue = 0;
- for (let i = 0; i < count; i++) {
- textMetrics.text = squeezedComboBox.textRole ? model[i][squeezedComboBox.textRole] : "";
- maxValue = Math.max(maxValue, textMetrics.width);
- }
- let iconWidth = iconRole? iconSize: 0;
- let total = iconWidth + maxValue + contentItemDelegate.leftPadding+contentItemDelegate.rightPadding+(contentItemDelegate.spacing*2);
- view.maxWidth = total;
- }
- Component.onCompleted: recalculatePopupWidth();
- onModelChanged: recalculatePopupWidth();
delegate: ItemDelegate {
id: squeezedComboDelegate;
- width: parent && parent != undefined? parent.width: 0;
+ width: Math.max(implicitWidth, parent && parent != undefined? parent.width: 0);
+ implicitWidth: leftPadding + textMetrics.advanceWidth + rightPadding + spacing + (squeezedComboBox.iconRole ? iconSize+spacing: 0);
palette: squeezedComboBox.palette;
highlighted: squeezedComboBox.highlightedIndex === index;
// Depending on the model, either modelData (read only) or model(read/write) is available.
// See https://bugreports.qt.io/browse/QTBUG-111176
- required property var modelData;
required property var model;
+ property var modelData: model.modelData;
property var mData: modelData && modelData !== undefined? modelData: model;
required property int index;
property string tooltipText: squeezedComboBox.toolTipRole ? mData[squeezedComboBox.toolTipRole] : "";
@@ -82,36 +65,43 @@ ComboBox {
icon.color: highlighted? palette.highlightedText: palette.text;
icon.source: squeezedComboBox.iconRole ? mData[squeezedComboBox.iconRole] : "";
text: squeezedComboBox.textRole ? mData[squeezedComboBox.textRole] : "";
+ property alias textMetricText: textMetrics.text;
+ textMetricText: text;
+
+ background: Rectangle {
+ color: squeezedComboDelegate.highlighted? palette.highlight: "transparent";
+ }
+
+ // To get the pop-up to be the same size as the maximum view, we first need to calculate
+ // the implict width via text-metrics, because icon label elides by default.
+ // then, on completed, we need to set the neededwidth to the max of all completed items.
+ // then, we need to set the width to the max of implicit and parent width, so the item fills.
+ Component.onCompleted: view.neededWidth = Math.max(view.neededWidth, implicitWidth);
+
+ TextMetrics {
+ id: textMetrics;
+ font: squeezedComboDelegate.font;
+ }
ToolTip.text: tooltipText;
ToolTip.visible: highlighted && tooltipText.length > 0;
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
}
- popup: Popup {
- id: squeezedComboPopup;
- y: squeezedComboBox.height - 1;
- x: squeezedComboBox.width - width;
- width: contentWidth;
- height: contentHeight;
- padding: 1;
-
- palette: squeezedComboBox.palette;
-
- contentItem: ListView {
- leftMargin: 0;
- rightMargin: 0;
- id: view;
- property int maxWidth: 100;
- implicitWidth: Math.max(maxWidth, squeezedComboBox.width);
- width: implicitWidth;
- implicitHeight: contentHeight;
- height: implicitHeight;
- clip: true;
- model: squeezedComboBox.delegateModel;
- currentIndex: squeezedComboBox.currentIndex;
- ScrollBar.vertical: ScrollBar {
- }
+ popup.palette: squeezedComboBox.palette;
+ popup.x: squeezedComboBox.width - popup.width;
+ popup.width: popup.contentWidth + popup.leftPadding + popup.rightPadding;
+ popup.contentItem: ListView {
+ id: view;
+ property int neededWidth: 100;
+ implicitWidth: Math.max(neededWidth, squeezedComboBox.width);
+ width: implicitWidth;
+ implicitHeight: contentHeight;
+ height: implicitHeight;
+ clip: true;
+ model: squeezedComboBox.delegateModel;
+ currentIndex: squeezedComboBox.currentIndex;
+ ScrollBar.vertical: ScrollBar {
}
}
}
diff --git a/plugins/dockers/textproperties/qml/TextPropertyBase.qml b/plugins/dockers/textproperties/qml/TextPropertyBase.qml
index 7cdeb51035..d42c4e30cc 100644
--- a/plugins/dockers/textproperties/qml/TextPropertyBase.qml
+++ b/plugins/dockers/textproperties/qml/TextPropertyBase.qml
@@ -12,7 +12,7 @@ Column {
property int firstColumnWidth: 32;
property int columnSpacing: 5;
padding: columnSpacing;
- width: parent? parent.width - (padding*2): 100;
+ width: parent && parent !== undefined? parent.width - (padding*2): 100;
height: visible? childrenRect.height: 0;
enum PropertyType {
diff --git a/plugins/dockers/textproperties/qml/WritingMode.qml b/plugins/dockers/textproperties/qml/WritingMode.qml
index e2b497f5e3..664c61390d 100644
--- a/plugins/dockers/textproperties/qml/WritingMode.qml
+++ b/plugins/dockers/textproperties/qml/WritingMode.qml
@@ -53,15 +53,15 @@ TextPropertyBase {
SqueezedComboBox {
id: writingModeCmb
model: [
- {text: i18nc("@label:inlistbox", "Horizontal"), value: KoSvgText.HorizontalTB, icon: "qrc:///22_light_format-text-direction-horizontal-tb.svg"},
- {text: i18nc("@label:inlistbox", "Vertical, Right to Left"), value: KoSvgText.VerticalRL, icon: "qrc:///22_light_format-text-direction-vertical-rl.svg"},
- {text: i18nc("@label:inlistbox", "Vertical, Left To Right"), value: KoSvgText.VerticalLR, icon: "qrc:///22_light_format-text-direction-vertical-lr.svg"}
+ {text: i18nc("@label:inlistbox", "Horizontal"), value: KoSvgText.HorizontalTB, icon: "qrc:///16_light_format-text-direction-horizontal-tb.svg"},
+ {text: i18nc("@label:inlistbox", "Vertical, Right to Left"), value: KoSvgText.VerticalRL, icon: "qrc:///16_light_format-text-direction-vertical-rl.svg"},
+ {text: i18nc("@label:inlistbox", "Vertical, Left To Right"), value: KoSvgText.VerticalLR, icon: "qrc:///16_light_format-text-direction-vertical-lr.svg"}
]
Layout.fillWidth: true;
textRole: "text";
valueRole: "value";
iconRole: "icon";
- iconSize: 22;
+ iconSize: 16;
onActivated: writingMode = currentValue;
}
}