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++
Implement the unit spinboxes.
Wolthera van Hövell tot Westerflierf7ac27aea557
diff --git a/libs/flake/text/lager/CssLengthPercentageModel.cpp b/libs/flake/text/lager/CssLengthPercentageModel.cppindex b1566e0072..dbba62a5b0 100644--- a/libs/flake/text/lager/CssLengthPercentageModel.cpp+++ b/libs/flake/text/lager/CssLengthPercentageModel.cpp@@ -6,8 +6,24 @@#include "CssLengthPercentageModel.h"#include <KisLager.h>+auto getValue = lager::lenses::getset (+ [] (const KoSvgText::CssLengthPercentage &data) -> qreal {+ if (data.unit == KoSvgText::CssLengthPercentage::Percentage) {+ return data.value * 100;+ } else {+ return data.value;+ }+}, [] (KoSvgText::CssLengthPercentage data, const qreal &val) -> KoSvgText::CssLengthPercentage {+ if (data.unit == KoSvgText::CssLengthPercentage::Percentage) {+ data.value = val * 0.01;+ } else {+ data.value = val;+ }+ return data;+});+CssLengthPercentageModel::CssLengthPercentageModel(lager::cursor<KoSvgText::CssLengthPercentage> _data): length(_data)- , LAGER_QT(value) {length[&KoSvgText::CssLengthPercentage::value]}+ , LAGER_QT(value) {length.zoom(getValue)}, LAGER_QT(unitType) {length[&KoSvgText::CssLengthPercentage::unit].zoom(kislager::lenses::do_static_cast<KoSvgText::CssLengthPercentage::UnitType, int>)}{}diff --git a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp b/libs/flake/text/lager/KoSvgTextPropertiesModel.cppindex c9481c5881..8dec971c4b 100644--- a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp+++ b/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp@@ -291,3 +291,31 @@ TextTransformModel *KoSvgTextPropertiesModel::textTransform(){return &this->textTransformModel;}++qreal KoSvgTextPropertiesModel::resolvedFontSize(bool fontSize)+{+ KoSvgTextPropertyData data = textData.get();+ KoSvgTextProperties inherited = data.inheritedProperties;+ inherited.inheritFrom(KoSvgTextProperties::defaultProperties(), true);+ if (fontSize) {+ return inherited.fontSize().value;+ } else {+ KoSvgTextProperties commonProperties = data.commonProperties;+ commonProperties.inheritFrom(inherited, true);+ return commonProperties.fontSize().value;+ }+}++qreal KoSvgTextPropertiesModel::resolvedXHeight(bool fontSize)+{+ KoSvgTextPropertyData data = textData.get();+ KoSvgTextProperties inherited = data.inheritedProperties;+ inherited.inheritFrom(KoSvgTextProperties::defaultProperties(), true);+ if (fontSize) {+ return inherited.xHeight();+ } else {+ KoSvgTextProperties commonProperties = data.commonProperties;+ commonProperties.inheritFrom(inherited, true);+ return commonProperties.xHeight();+ }+}diff --git a/libs/flake/text/lager/KoSvgTextPropertiesModel.h b/libs/flake/text/lager/KoSvgTextPropertiesModel.hindex 03f23f7ff0..315a14f97a 100644--- a/libs/flake/text/lager/KoSvgTextPropertiesModel.h+++ b/libs/flake/text/lager/KoSvgTextPropertiesModel.h@@ -153,6 +153,9 @@ public:/// We're selecting a span of text instead of the whole paragraph.LAGER_QT_CURSOR(bool, spanSelection);+ Q_INVOKABLE qreal resolvedFontSize(bool fontSize = false);+ Q_INVOKABLE qreal resolvedXHeight(bool fontSize = false);+Q_SIGNALS:void textPropertyChanged();void fontSizeChanged();diff --git a/libs/flake/text/lager/LineHeightModel.cpp b/libs/flake/text/lager/LineHeightModel.cppindex 4642f4e002..892d0b367c 100644--- a/libs/flake/text/lager/LineHeightModel.cpp+++ b/libs/flake/text/lager/LineHeightModel.cpp@@ -12,13 +12,21 @@ auto getValue = lager::lenses::getset (if (data.isNumber) {return data.value;} else {- return data.length.value;+ if (data.length.unit == KoSvgText::CssLengthPercentage::Percentage) {+ return data.length.value * 100;+ } else {+ return data.length.value;+ }}}, [] (KoSvgText::LineHeightInfo data, const qreal &val) -> KoSvgText::LineHeightInfo {if (data.isNumber) {data.value = val;} else {- data.length.value = val;+ if (data.length.unit == KoSvgText::CssLengthPercentage::Percentage) {+ data.length.value = val * 0.01;+ } else {+ data.length.value = val;+ }}return data;});@@ -41,9 +49,10 @@ auto getUnit = lager::lenses::getset (return LineHeightModel::LineHeightType::Absolute;}}, [] (KoSvgText::LineHeightInfo data, const LineHeightModel::LineHeightType &val) -> KoSvgText::LineHeightInfo {- if (val == LineHeightModel::Lines) {+ if (val == LineHeightModel::LineHeightType::Lines) {data.isNumber = true;} else {+ data.isNumber = false;switch(val) {case LineHeightModel::LineHeightType::Absolute:data.length.unit = KoSvgText::CssLengthPercentage::Absolute;diff --git a/libs/flake/text/lager/TabSizeModel.cpp b/libs/flake/text/lager/TabSizeModel.cppindex e86e42eb24..27adf8c26b 100644--- a/libs/flake/text/lager/TabSizeModel.cpp+++ b/libs/flake/text/lager/TabSizeModel.cpp@@ -44,6 +44,7 @@ auto getUnit = lager::lenses::getset (if (val == TabSizeModel::TabSizeType::Spaces) {data.isNumber = true;} else {+ data.isNumber = false;switch(val) {case TabSizeModel::TabSizeType::Absolute:data.length.unit = KoSvgText::CssLengthPercentage::Absolute;diff --git a/plugins/dockers/textproperties/qml/Direction.qml b/plugins/dockers/textproperties/qml/Direction.qmlindex c3ab60ec49..ed6eab14a4 100644--- a/plugins/dockers/textproperties/qml/Direction.qml+++ b/plugins/dockers/textproperties/qml/Direction.qml@@ -20,7 +20,6 @@ TextPropertyBase {unicodeBidi = properties.unicodeBidi;var set = properties.directionState !== KoSvgTextPropertiesModel.PropertyUnset;var pType = parentPropertyType === TextPropertyBase.Paragraph? !properties.spanSelection: properties.spanSelection;- console.log("set", set, "type matches", pType)visible = set && pType;blockSignals = false;}diff --git a/plugins/dockers/textproperties/qml/DoubleSpinBox.qml b/plugins/dockers/textproperties/qml/DoubleSpinBox.qmlnew file mode 100644index 0000000000..44ebc7003d--- /dev/null+++ b/plugins/dockers/textproperties/qml/DoubleSpinBox.qml@@ -0,0 +1,29 @@+/*+ * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+import QtQuick 2.15+import QtQuick.Controls 2.15+++// Simple double spinbox based on Qt example implementation, should proly be switched to spinbox slider at some point.+SpinBox {+ editable: true;++ property int decimals: 2;+ property int multiplier: Math.pow(10, decimals);++ validator: DoubleValidator {+ bottom: Math.min(from, to)+ top: Math.max(from, to)+ }++ textFromValue: function(value, locale) {+ return Number(value / multiplier).toLocaleString(locale, 'f', decimals)+ }++ valueFromText: function(text, locale) {+ return Number.fromLocaleString(locale, text) * multiplier;+ }+}diff --git a/plugins/dockers/textproperties/qml/FontSize.qml b/plugins/dockers/textproperties/qml/FontSize.qmlindex 20ce130568..7c89bf8cdb 100644--- a/plugins/dockers/textproperties/qml/FontSize.qml+++ b/plugins/dockers/textproperties/qml/FontSize.qml@@ -13,16 +13,24 @@ TextPropertyBase {propertyType: TextPropertyBase.Character;property alias fontSize: fontSizeSpn.value;+ property alias fontSizeUnit: fontSizeUnitCmb.comboBoxUnit;onPropertiesUpdated: {blockSignals = true;- fontSize = properties.fontSize.value;+ fontSize = properties.fontSize.value * fontSizeSpn.multiplier;+ fontSizeUnit = properties.fontSize.unitType;visible = properties.fontSizeState !== KoSvgTextPropertiesModel.PropertyUnset;blockSignals = false;}onFontSizeChanged: {if (!blockSignals) {- properties.fontSize.value = fontSize;+ properties.fontSize.value = fontSize / fontSizeSpn.multiplier;+ }+ }+ onFontSizeUnitChanged: {+ fontSizeUnitCmb.currentIndex = fontSizeUnitCmb.indexOfValue(fontSizeUnit);+ if (!blockSignals) {+ properties.fontSize.unitType = fontSizeUnitCmb.comboBoxUnit;}}@@ -41,21 +49,20 @@ TextPropertyBase {Layout.fillWidth: true;}- SpinBox {+ DoubleSpinBox {id: fontSizeSpn;editable: true;Layout.fillWidth: true;++ from: 0;+ to: 999 * multiplier;+ stepSize: 100;}- ComboBox {- model: [- {text: i18nc("@label:inlistbox", "Pt"), value: 0},- {text: i18nc("@label:inlistbox", "Em"), value: 1},- {text: i18nc("@label:inlistbox", "Ex"), value: 2},- {text: i18nc("@label:inlistbox", "%"), value: 3}- ]- textRole: "text";- valueRole: "value";+ UnitComboBox {+ id: fontSizeUnitCmb;+ spinBoxControl: fontSizeSpn;+ isFontSize: true;Layout.fillWidth: true;}}diff --git a/plugins/dockers/textproperties/qml/LetterSpacing.qml b/plugins/dockers/textproperties/qml/LetterSpacing.qmlindex fd95ff3ee9..799747dfb5 100644--- a/plugins/dockers/textproperties/qml/LetterSpacing.qml+++ b/plugins/dockers/textproperties/qml/LetterSpacing.qml@@ -12,16 +12,25 @@ TextPropertyBase {propertyName: i18nc("@label:spinbox", "Letter Spacing");propertyType: TextPropertyBase.Character;property alias letterSpacing: letterSpacingSpn.value;+ property alias letterSpacingUnit: letterSpacingUnitCmb.comboBoxUnit;onPropertiesUpdated: {blockSignals = true;- letterSpacing = properties.letterSpacing.value;+ letterSpacing = properties.letterSpacing.value * letterSpacingSpn.multiplier;+ letterSpacingUnit = properties.letterSpacing.unitType;visible = properties.letterSpacingState !== KoSvgTextPropertiesModel.PropertyUnset;blockSignals = false;}onLetterSpacingChanged: {if (!blockSignals) {- properties.letterSpacing.value = letterSpacing;+ properties.letterSpacing.value = letterSpacing / letterSpacingSpn.multiplier;+ }+ }++ onLetterSpacingUnitChanged: {+ letterSpacingUnitCmb.currentIndex = letterSpacingUnitCmb.indexOfValue(letterSpacingUnit);+ if (!blockSignals) {+ properties.letterSpacing.unitType = letterSpacingUnit;}}@@ -40,14 +49,18 @@ TextPropertyBase {Layout.fillWidth: true;}- SpinBox {+ DoubleSpinBox {id: letterSpacingSpneditable: true;Layout.fillWidth: true;+ from: -999 * multiplier;+ to: 999 * multiplier;}- ComboBox {- model: ["Pt", "Em", "Ex"];+ UnitComboBox {+ id: letterSpacingUnitCmb+ spinBoxControl: letterSpacingSpn;+ isFontSize: false;Layout.fillWidth: true;}}diff --git a/plugins/dockers/textproperties/qml/LineHeight.qml b/plugins/dockers/textproperties/qml/LineHeight.qmlindex cc76e7a5fb..b1936b2bec 100644--- a/plugins/dockers/textproperties/qml/LineHeight.qml+++ b/plugins/dockers/textproperties/qml/LineHeight.qml@@ -18,7 +18,7 @@ TextPropertyBase {onPropertiesUpdated: {blockSignals = true;isNormal = properties.lineHeight.isNormal;- lineHeight = properties.lineHeight.value;+ lineHeight = properties.lineHeight.value * lineHeightSpn.multiplier;lineHeightUnit = properties.lineHeight.unit;visible = properties.lineHeightState !== KoSvgTextPropertiesModel.PropertyUnset;blockSignals = false;@@ -38,7 +38,7 @@ TextPropertyBase {onLineHeightChanged: {if (!blockSignals) {- properties.lineHeight.value = lineHeight;+ properties.lineHeight.value = lineHeight / lineHeightSpn.multiplier;}}@@ -70,16 +70,19 @@ TextPropertyBase {width: firstColumnWidth;height: 1;}- SpinBox {+ DoubleSpinBox {id: lineHeightSpnLayout.fillWidth: true;enabled: !lineHeightNormalCbx.enabled;+ from: 0;+ to: 999 * multiplier;}ComboBox {- id: lineHeightUnitCmb+ id: lineHeightUnitCmb;+ property QtObject spinBoxControl: lineHeightSpn;model: [- { text: i18nc("@label:inlistbox", "Pt"), value: LineHeightModel.Pt},+ { text: i18nc("@label:inlistbox", "Pt"), value: LineHeightModel.Absolute},{ text: i18nc("@label:inlistbox", "Em"), value: LineHeightModel.Em},{ text: i18nc("@label:inlistbox", "Ex"), value: LineHeightModel.Ex},{ text: i18nc("@label:inlistbox", "%"), value: LineHeightModel.Percentage},@@ -88,7 +91,32 @@ TextPropertyBase {textRole: "text";valueRole: "value";enabled: !lineHeightNormalCbx.enabled;- onActivated: lineHeightUnit = lineHeightUnitCmb.currentValue;++ onActivated: {+ var currentValueInPt = 0;+ if (lineHeightUnit === LineHeightModel.Absolute) {+ currentValueInPt = spinBoxControl.value;+ } else if (lineHeightUnit === LineHeightModel.Ex) {+ currentValueInPt = spinBoxControl.value * properties.resolvedXHeight(false);+ } else if (lineHeightUnit === LineHeightModel.Percentage) {+ currentValueInPt = (spinBoxControl.value / 100) * properties.resolvedFontSize(false);+ } else { // EM, Lines+ currentValueInPt = spinBoxControl.value * properties.resolvedFontSize(false);+ }++ var newValue = 0;+ if (currentValue === LineHeightModel.Absolute) {+ newValue = currentValueInPt+ } else if (currentValue === LineHeightModel.Ex) {+ newValue = currentValueInPt / properties.resolvedXHeight(false);+ } else if (currentValue === LineHeightModel.Percentage) {+ newValue = (currentValueInPt / properties.resolvedFontSize(false)) * 100;+ } else { // Em, Lines+ newValue = currentValueInPt / properties.resolvedFontSize(false);+ }+ lineHeightUnit = currentValue;+ spinBoxControl.value = newValue;+ }}}}diff --git a/plugins/dockers/textproperties/qml/TabSize.qml b/plugins/dockers/textproperties/qml/TabSize.qmlindex 427dfc9a73..7c3fcdf150 100644--- a/plugins/dockers/textproperties/qml/TabSize.qml+++ b/plugins/dockers/textproperties/qml/TabSize.qml@@ -16,15 +16,15 @@ TextPropertyBase {onPropertiesUpdated: {blockSignals = true;- tabSize = properties.tabSize.value;+ tabSize = properties.tabSize.value * tabSizeSpn.multiplier;tabSizeUnit = properties.tabSize.unit;- visible = properties.tabSizeState !== KoSvgTextPropertiesModel.PropertySet;+ visible = properties.tabSizeState !== KoSvgTextPropertiesModel.PropertyUnset;blockSignals = false;}onTabSizeChanged: {if (!blockSignals) {- properties.tabSize.value = tabSize;+ properties.tabSize.value = tabSize / tabSizeSpn.multiplier;}}@@ -57,12 +57,15 @@ TextPropertyBase {height: 1;}- SpinBox {+ DoubleSpinBox {id: tabSizeSpn;Layout.fillWidth: true;+ from: 0;+ to: 100 * multiplier;}ComboBox {- id: tabSizeUnitCmb+ id: tabSizeUnitCmb;+ property QtObject spinBoxControl: tabSizeSpn;model: [{text: i18nc("@label:inlistbox", "Spaces"), value: TabSizeModel.Spaces},{text: i18nc("@label:inlistbox", "Pt"), value: TabSizeModel.Absolute},@@ -71,8 +74,35 @@ TextPropertyBase {]textRole: "text";valueRole: "value";- onActivated: tabSizeUnit = currentValue;Layout.fillWidth: true;++ onActivated: {+ if (currentValue === TabSizeModel.Spaces) {+ tabSizeUnit = currentValue;+ spinBoxControl.value = properties.tabSize.value * tabSizeSpn.multiplier;+ } else {++ var currentValueInPt = 0;+ if (tabSizeUnit === TabSizeModel.Absolute) {+ currentValueInPt = spinBoxControl.value;+ } else if (tabSizeUnit === TabSizeModel.Ex) {+ currentValueInPt = spinBoxControl.value * properties.resolvedXHeight(false);+ } else { // EM, Lines+ currentValueInPt = spinBoxControl.value * properties.resolvedFontSize(false);+ }++ var newValue = 0;+ if (currentValue === TabSizeModel.Absolute) {+ newValue = currentValueInPt+ } else if (currentValue === TabSizeModel.Ex) {+ newValue = currentValueInPt / properties.resolvedXHeight(false);+ } else { // Em+ newValue = currentValueInPt / properties.resolvedFontSize(false);+ }+ tabSizeUnit = currentValue;+ spinBoxControl.value = newValue;+ }+ }}}diff --git a/plugins/dockers/textproperties/qml/TextIndent.qml b/plugins/dockers/textproperties/qml/TextIndent.qmlindex 3e180353db..c010c96d22 100644--- a/plugins/dockers/textproperties/qml/TextIndent.qml+++ b/plugins/dockers/textproperties/qml/TextIndent.qml@@ -15,10 +15,12 @@ CollapsibleGroupProperty {property alias textIndentValue: textIndentSpn.value;property alias hanging: indentHangingCkb.checked;property alias eachLine: eachLineCkb.checked;+ property alias textIndentUnit: textIndentUnitCmb.comboBoxUnit;onPropertiesUpdated: {blockSignals = true;- textIndentValue = properties.textIndent.length.value;+ textIndentValue = properties.textIndent.length.value * textIndentSpn.multiplier;+ textIndentUnit = properties.textIndent.length.unitType;hanging = properties.textIndent.hanging;eachLine = properties.textIndent.eachLine;visible = properties.textIndentState !== KoSvgTextPropertiesModel.PropertyUnset;@@ -27,7 +29,14 @@ CollapsibleGroupProperty {onTextIndentValueChanged: {if (!blockSignals) {- properties.textIndent.length.value = textIndentValue;+ properties.textIndent.length.value = textIndentValue / textIndentSpn.multiplier;+ }+ }++ onTextIndentUnitChanged: {+ textIndentUnitCmb.currentIndex = textIndentUnitCmb.indexOfValue(textIndentUnit);+ if (!blockSignals) {+ properties.textIndent.length.unitType = textIndentUnit;}}@@ -46,12 +55,17 @@ CollapsibleGroupProperty {titleItem: RowLayout {spacing: columnSpacing;Layout.fillWidth: true;- SpinBox {+ DoubleSpinBox {id: textIndentSpn;Layout.fillWidth: true;+ from: 0;+ to: 999 * multiplier;}- ComboBox {- model: ["Pt", "Em", "Ex"]+ /// Note: percentage calculation in the default unitcombobox isn't great for textIndent as it assumes 100% = fontsize,+ /// While spec-wise, it's the inline length that defines percentage.+ UnitComboBox {+ id: textIndentUnitCmb;+ spinBoxControl: textIndentSpn;Layout.fillWidth: true;}}diff --git a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qmlindex 0c5fe9a503..7bdf7ad371 100644--- a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml+++ b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml@@ -1,3 +1,8 @@+/*+ * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */import QtQuick 2.15import QtQuick.Controls 2.15import QtQuick.Layouts 1.15diff --git a/plugins/dockers/textproperties/qml/UnitComboBox.qml b/plugins/dockers/textproperties/qml/UnitComboBox.qmlnew file mode 100644index 0000000000..b0a01197ef--- /dev/null+++ b/plugins/dockers/textproperties/qml/UnitComboBox.qml@@ -0,0 +1,48 @@+/*+ * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+import QtQuick 2.15+import QtQuick.Controls 2.15+import org.krita.flake.text 1.0++ComboBox {+ property QtObject spinBoxControl;+ property bool isFontSize: false;+ property int comboBoxUnit;++ 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}+ ]+ textRole: "text";+ valueRole: "value";+ onActivated: {+ var currentValueInPt = 0;+ if (comboBoxUnit === 0) {+ currentValueInPt = spinBoxControl.value;+ } else if (comboBoxUnit === 2) {+ currentValueInPt = spinBoxControl.value * properties.resolvedFontSize(isFontSize);+ } else if (comboBoxUnit === 3) {+ currentValueInPt = spinBoxControl.value * properties.resolvedXHeight(isFontSize);+ } else if (comboBoxUnit === 1) {+ currentValueInPt = (spinBoxControl.value / 100) * properties.resolvedFontSize(isFontSize);+ }++ var newValue = 0;+ if (currentValue === 0) {+ newValue = currentValueInPt+ } else if (currentValue === 2) {+ newValue = currentValueInPt / properties.resolvedFontSize(isFontSize);+ } else if (currentValue === 3) {+ newValue = currentValueInPt / properties.resolvedXHeight(isFontSize);+ } else if (currentValue === 1) {+ newValue = (currentValueInPt / properties.resolvedFontSize(isFontSize)) * 100;+ }+ comboBoxUnit = currentValue;+ spinBoxControl.value = newValue;+ }+}diff --git a/plugins/dockers/textproperties/qml/WordSpacing.qml b/plugins/dockers/textproperties/qml/WordSpacing.qmlindex 24cecf0559..e666d1df42 100644--- a/plugins/dockers/textproperties/qml/WordSpacing.qml+++ b/plugins/dockers/textproperties/qml/WordSpacing.qml@@ -13,16 +13,25 @@ TextPropertyBase {propertyType: TextPropertyBase.Character;property alias wordSpacing: wordSpacingSpn.value;visible: properties.wordSpacingState !== KoSvgTextPropertiesModel.PropertyUnset;+ property alias wordSpacingUnit: wordSpacingUnitCmb.comboBoxUnit;onPropertiesUpdated: {blockSignals = true;- wordSpacing = properties.wordSpacing.value;+ wordSpacing = properties.wordSpacing.value * wordSpacingSpn.multiplier;+ wordSpacingUnit = properties.wordSpacing.unitType;visible = properties.wordSpacingState !== KoSvgTextPropertiesModel.PropertyUnset;blockSignals = false;}onWordSpacingChanged: {if (!blockSignals) {- properties.wordSpacing.value = wordSpacing;+ properties.wordSpacing.value = wordSpacing / wordSpacingSpn.multiplier;+ }+ }++ onWordSpacingUnitChanged: {+ wordSpacingUnitCmb.currentIndex = wordSpacingUnitCmb.indexOfValue(wordSpacingUnit);+ if (!blockSignals) {+ properties.wordSpacing.unitType = wordSpacingUnit;}}@@ -41,14 +50,18 @@ TextPropertyBase {Layout.fillWidth: true;}- SpinBox {+ DoubleSpinBox {id: wordSpacingSpneditable: true;Layout.fillWidth: true;+ from: -999 * multiplier;+ to: 999 * multiplier;}- ComboBox {- model: ["Pt", "Em", "Ex"];+ UnitComboBox {+ id: wordSpacingUnitCmb+ spinBoxControl: wordSpacingSpn;+ isFontSize: false;Layout.fillWidth: true;}}diff --git a/plugins/dockers/textproperties/textproperties.qrc b/plugins/dockers/textproperties/textproperties.qrcindex 1fafea8d1f..9c95a34b54 100644--- a/plugins/dockers/textproperties/textproperties.qrc+++ b/plugins/dockers/textproperties/textproperties.qrc@@ -31,5 +31,7 @@<file alias="UnderlinePosition.qml">qml/UnderlinePosition.qml</file><file alias="RevertPropertyButton.qml">qml/RevertPropertyButton.qml</file><file alias="TextPropertyBaseList.qml">qml/TextPropertyBaseList.qml</file>+ <file alias="UnitComboBox.qml">qml/UnitComboBox.qml</file>+ <file alias="DoubleSpinBox.qml">qml/DoubleSpinBox.qml</file></qresource></RCC>diff --git a/plugins/tools/svgtexttool/SvgTextCursor.cpp b/plugins/tools/svgtexttool/SvgTextCursor.cppindex 95b0794cb9..1b01d9b0d4 100644--- a/plugins/tools/svgtexttool/SvgTextCursor.cpp+++ b/plugins/tools/svgtexttool/SvgTextCursor.cpp@@ -1452,7 +1452,7 @@ KoSvgTextProperties SvgTextPropertyCursor::getInheritedProperties(){// 9 times out of 10 this is correct, though we could do better by actually// getting inherited properties for the range and not just defaulting to the paragraph.- return d->parent->shape()? d->parent->shape()->textProperties(): KoSvgTextProperties::defaultProperties();+ return (d->parent->shape() && spanSelection())? d->parent->shape()->textProperties(): KoSvgTextProperties::defaultProperties();}void SvgTextPropertyCursor::setPropertiesOnSelected(KoSvgTextProperties properties, QSet<KoSvgTextProperties::PropertyId> removeProperties)