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++

Remove percentage from word and letter spacing.

Wolthera van Hövell tot Westerflier93d390d29a3d
diff --git a/plugins/dockers/textproperties/qml/LetterSpacing.qml b/plugins/dockers/textproperties/qml/LetterSpacing.qml
index b618a87bc0..d67a10bf41 100644
--- a/plugins/dockers/textproperties/qml/LetterSpacing.qml
+++ b/plugins/dockers/textproperties/qml/LetterSpacing.qml
@@ -69,6 +69,7 @@ TextPropertyBase {
spinBoxControl: letterSpacingSpn;
isFontSize: false;
Layout.fillWidth: true;
+ allowPercentage: false; // CSS-Text-4 has percentages for letter-spacing, but so does SVG 1.1, and they both are implemented differently.
}
}
}
diff --git a/plugins/dockers/textproperties/qml/UnitComboBox.qml b/plugins/dockers/textproperties/qml/UnitComboBox.qml
index 92728030e9..a08ee90180 100644
--- a/plugins/dockers/textproperties/qml/UnitComboBox.qml
+++ b/plugins/dockers/textproperties/qml/UnitComboBox.qml
@@ -11,13 +11,30 @@ ComboBox {
property QtObject spinBoxControl;
property bool isFontSize: false;
property int comboBoxUnit;
+ property bool allowPercentage: true;
wheelEnabled: true;
+ property string ptString: i18nc("@label:inlistbox", "Pt");
+ property string emString: i18nc("@label:inlistbox", "Em");
+ property string exString: i18nc("@label:inlistbox", "Ex");
+ property string prcString: i18nc("@label:inlistbox", "%");
+
+ Component.onCompleted: {
+ if (!allowPercentage) {
+ // Not great, but listmodels don't seem to allow adding i18n strings as properties, because they are in functions?
+ model = [
+ {text: ptString, value: 0},
+ {text: emString, value: 2},
+ {text: exString, value: 3}
+ ];
+ }
+ }
+
model: [
- {text: i18nc("@label:inlistbox", "Pt"), value: 0},
- {text: i18nc("@label:inlistbox", "Em"), value: 2},
- {text: i18nc("@label:inlistbox", "Ex"), value: 3},
- {text: i18nc("@label:inlistbox", "%"), value: 1}
+ {text: ptString, value: 0},
+ {text: emString, value: 2},
+ {text: exString, value: 3},
+ {text: prcString, value: 1}
]
textRole: "text";
valueRole: "value";
diff --git a/plugins/dockers/textproperties/qml/WordSpacing.qml b/plugins/dockers/textproperties/qml/WordSpacing.qml
index 470804e501..bab6df66d5 100644
--- a/plugins/dockers/textproperties/qml/WordSpacing.qml
+++ b/plugins/dockers/textproperties/qml/WordSpacing.qml
@@ -70,6 +70,7 @@ TextPropertyBase {
spinBoxControl: wordSpacingSpn;
isFontSize: false;
Layout.fillWidth: true;
+ allowPercentage: false; // CSS-Text-4 has percentages for word-spacing, but so does SVG 1.1, and they both are implemented differently.
}
}
}