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++
Greatly improve adding/removing text properties, as well as tristate display.
Wolthera van Hövell tot Westerflierb12aa6bc860e
diff --git a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp b/libs/flake/text/lager/KoSvgTextPropertiesModel.cppindex 8dec971c4b..e451c5fde7 100644--- a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp+++ b/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp@@ -36,8 +36,10 @@ auto propertyModifyState = [](KoSvgTextProperties::PropertyId propId) { return l[propId](const KoSvgTextPropertyData &value) -> KoSvgTextPropertiesModel::PropertyState {if (value.commonProperties.hasProperty(propId)) {return KoSvgTextPropertiesModel::PropertySet;- } else if (value.tristate.contains(propId) || value.inheritedProperties.hasProperty(propId)) {+ } else if (value.tristate.contains(propId)) {return KoSvgTextPropertiesModel::PropertyTriState;+ } else if (value.inheritedProperties.hasProperty(propId)) {+ return KoSvgTextPropertiesModel::PropertyInherited;}return KoSvgTextPropertiesModel::PropertyUnset;},@@ -47,8 +49,8 @@ auto propertyModifyState = [](KoSvgTextProperties::PropertyId propId) { return l} else {// Because tristate represents properties that are set but mixed, there's no value in being able to set them from the UX.// so if we receive such a signal, it is incorrect.- if (state == KoSvgTextPropertiesModel::PropertyTriState) {- qWarning() << "Receiving request to set property tristate, this will unset the property instead";+ if (state == KoSvgTextPropertiesModel::PropertyTriState || state == KoSvgTextPropertiesModel::PropertyInherited) {+ qWarning() << "Receiving request to set property tristate or inherited, this will unset the property instead";}value.commonProperties.removeProperty(propId);}diff --git a/libs/flake/text/lager/KoSvgTextPropertiesModel.h b/libs/flake/text/lager/KoSvgTextPropertiesModel.hindex 315a14f97a..6a974b0077 100644--- a/libs/flake/text/lager/KoSvgTextPropertiesModel.h+++ b/libs/flake/text/lager/KoSvgTextPropertiesModel.h@@ -62,7 +62,8 @@ public:enum PropertyState {PropertyUnset,PropertySet,- PropertyTriState+ PropertyTriState,+ PropertyInherited};Q_ENUM(PropertyState)diff --git a/plugins/dockers/textproperties/qml/AlignmentBaseline.qml b/plugins/dockers/textproperties/qml/AlignmentBaseline.qmlindex 9ff403dfe5..c07a2744d8 100644--- a/plugins/dockers/textproperties/qml/AlignmentBaseline.qml+++ b/plugins/dockers/textproperties/qml/AlignmentBaseline.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label:listbox", "Alignment Baseline");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Alignment Baseline allows controling how this range of text is aligned to the parent text.");+ searchTerms: i18nc("comma separated search terms for the alignment-baseline property, matching is case-insensitive",+ "alignment-baseline, mojisoroe");property int baselineSelection;onPropertiesUpdated: {@@ -27,13 +31,15 @@ TextPropertyBase {}}+ onEnableProperty: properties.alignmentBaselineState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {columns: 2;columnSpacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.alignmentBaselineState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.alignmentBaselineState;onClicked: properties.alignmentBaselineState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/BaselineShift.qml b/plugins/dockers/textproperties/qml/BaselineShift.qmlindex d73075d19b..ff2ad693a7 100644--- a/plugins/dockers/textproperties/qml/BaselineShift.qml+++ b/plugins/dockers/textproperties/qml/BaselineShift.qml@@ -11,21 +11,34 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label", "Baseline-Shift")propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Baseline shift allows moving the text away from the baseline, either by predefined super and subscript values, or by a fixed amount.");+ searchTerms: i18nc("comma separated search terms for the baseline-shift property, matching is case-insensitive",+ "baseline-shift, superscript, subscript");property alias baselineShiftValue: baselineShiftSpn.value;+ property alias baselineShiftUnit: baselineShiftUnitCmb.comboBoxUnit;property int baselineShiftMode;onPropertiesUpdated: {blockSignals = true;- baselineShiftValue = properties.baselineShiftValue.value;+ baselineShiftValue = properties.baselineShiftValue.value * baselineShiftSpn.multiplier;baselineShiftMode = properties.baselineShiftMode;+ baselineShiftUnit = properties.baselineShiftValue.unitType;visible = properties.baselineShiftState !== KoSvgTextPropertiesModel.PropertyUnsetblockSignals = false;}onBaselineShiftValueChanged: {if (!blockSignals) {- properties.baselineShiftValue.value = baselineShiftValue;+ properties.baselineShiftValue.value = baselineShiftValue / baselineShiftSpn.multiplier;+ }+ }++ onBaselineShiftUnitChanged: {+ baselineShiftUnitCmb.currentIndex = baselineShiftUnitCmb.indexOfValue(baselineShiftUnit);+ if (!blockSignals) {+ properties.baselineShiftValue.unitType = baselineShiftUnit;}}@@ -37,13 +50,15 @@ TextPropertyBase {}}+ onEnableProperty: properties.baselineShiftState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {columns: 3;columnSpacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.baselineShiftState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.baselineShiftState;onClicked: properties.baselineShiftState = KoSvgTextPropertiesModel.PropertyUnset;}@@ -79,14 +94,17 @@ TextPropertyBase {width: firstColumnWidth;height: 1;}- SpinBox {+ DoubleSpinBox {id: baselineShiftSpnLayout.fillWidth: true;enabled: baselineShiftMode == 3;+ from: -999 * multiplier;+ to: 999 * multiplier;}- ComboBox {- model: ["Pt", "Em", "Ex"];+ UnitComboBox {+ id: baselineShiftUnitCmb;+ spinBoxControl: baselineShiftSpn;Layout.fillWidth: true;}}diff --git a/plugins/dockers/textproperties/qml/Direction.qml b/plugins/dockers/textproperties/qml/Direction.qmlindex ed0c2824da..6886bb9c64 100644--- a/plugins/dockers/textproperties/qml/Direction.qml+++ b/plugins/dockers/textproperties/qml/Direction.qml@@ -11,6 +11,11 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label:listbox", "Direction")propertyType: TextPropertyBase.Mixed;+ toolTip: i18nc("@info:tooltip",+ "Direction sets whether the text is left-to-right or right-to-left.");+ searchTerms: i18nc("comma separated search terms for the direction property, matching is case-insensitive",+ "right to left, rtl, direction, bidirectional, isolate, embed, override");+property int direction;property int unicodeBidi;@@ -38,6 +43,8 @@ TextPropertyBase {}}+ onEnableProperty: properties.directionState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {id: rowcolumns: 3@@ -45,7 +52,7 @@ TextPropertyBase {width: parent.width;RevertPropertyButton {- revertEnabled: properties.directionState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.directionState;onClicked: properties.directionState = KoSvgTextPropertiesModel.PropertyUnset;}@@ -69,7 +76,7 @@ TextPropertyBase {RevertPropertyButton {visible: parentPropertyType === TextPropertyBase.Character;- revertEnabled: properties.unicodeBidiState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.unicodeBidiState;onClicked: properties.unicodeBidiState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/DominantBaseline.qml b/plugins/dockers/textproperties/qml/DominantBaseline.qmlindex 65b11b2c87..79c11dbb81 100644--- a/plugins/dockers/textproperties/qml/DominantBaseline.qml+++ b/plugins/dockers/textproperties/qml/DominantBaseline.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label:listbox", "Dominant Baseline")propertyType: TextPropertyBase.Paragraph;+ toolTip: i18nc("@info:tooltip",+ "Dominant Baseline specifies how stretches of text of different sizes are aligned, it is also the default for Alignment Baseline.");+ searchTerms: i18nc("comma separated search terms for the dominant-baseline property, matching is case-insensitive",+ "dominant-baseline, mojisoroe");property int baselineSelectiononPropertiesUpdated: {@@ -27,13 +31,15 @@ TextPropertyBase {}}+ onEnableProperty: properties.dominantBaselineState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {columns: 2;columnSpacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.dominantBaselineState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.dominantBaselineState;onClicked: properties.dominantBaselineState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/FontFamily.qml b/plugins/dockers/textproperties/qml/FontFamily.qmlindex b7b5f2159e..885b6486f0 100644--- a/plugins/dockers/textproperties/qml/FontFamily.qml+++ b/plugins/dockers/textproperties/qml/FontFamily.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0CollapsibleGroupProperty {propertyName: i18nc("@label", "Font Family");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Font family allows selecting a list of fonts that should be used for the current text. The first font family is the primary font used, while each font family after that is used for fallback.");+ searchTerms: i18nc("comma separated search terms for the font-family property, matching is case-insensitive",+ "font-family, typeface, font, fallback");property var fontFamilies: [];property var fontFamilyModel : [];@@ -43,6 +47,8 @@ CollapsibleGroupProperty {}}+ onEnableProperty: properties.fontFamiliesState = KoSvgTextPropertiesModel.PropertySet;+contentItem: GridLayout {columns: 2anchors.left: parent.left@@ -50,7 +56,7 @@ CollapsibleGroupProperty {columnSpacing: columnSpacing;RevertPropertyButton {- revertEnabled: properties.fontFamiliesState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.fontFamiliesState;onClicked: properties.fontFamiliesState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/FontSize.qml b/plugins/dockers/textproperties/qml/FontSize.qmlindex 7c89bf8cdb..1dbc91cc63 100644--- a/plugins/dockers/textproperties/qml/FontSize.qml+++ b/plugins/dockers/textproperties/qml/FontSize.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label:spinbox", "Font Size");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Font size allows setting the size of the characters.");+ searchTerms: i18nc("comma separated search terms for the fontsize property, matching is case-insensitive",+ "size, small, big, medium");property alias fontSize: fontSizeSpn.value;property alias fontSizeUnit: fontSizeUnitCmb.comboBoxUnit;@@ -34,12 +38,14 @@ TextPropertyBase {}}+ onEnableProperty: properties.fontSizeState = KoSvgTextPropertiesModel.PropertySet;+RowLayout {spacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.fontSizeState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.fontSizeState;onClicked: properties.fontSizeState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/FontStyle.qml b/plugins/dockers/textproperties/qml/FontStyle.qmlindex ca0a030232..5d580536a7 100644--- a/plugins/dockers/textproperties/qml/FontStyle.qml+++ b/plugins/dockers/textproperties/qml/FontStyle.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0CollapsibleGroupProperty {propertyName: i18nc("@label", "Font Style");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Font style allows setting the sub style of the given font family, such as italics and bold");+ searchTerms: i18nc("comma separated search terms for the fontsize property, matching is case-insensitive",+ "weight, width, style, italics, oblique, font-style, font-stretch, font-weight, bold, optical-size, variation");property alias fontWeight: fontWeightSpn.value;property alias fontWidth: fontStretchSpn.value;@@ -53,6 +57,10 @@ CollapsibleGroupProperty {}}+ onEnableProperty: {+ properties.fontWeightState = KoSvgTextPropertiesModel.PropertySet;+ }+titleItem: ComboBox {id: styleCmb;Layout.fillWidth: true;@@ -65,7 +73,7 @@ CollapsibleGroupProperty {columnSpacing: 5;RevertPropertyButton {- revertEnabled: properties.fontWeightState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.fontWeightState;onClicked: properties.fontWeightState = KoSvgTextPropertiesModel.PropertyUnset;}@@ -87,7 +95,7 @@ CollapsibleGroupProperty {RevertPropertyButton {- revertEnabled: properties.fontWidthState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.fontWidthState;onClicked: properties.fontWidthState = KoSvgTextPropertiesModel.PropertyUnset;}Label {@@ -107,7 +115,7 @@ CollapsibleGroupProperty {}RevertPropertyButton {- revertEnabled: properties.fontStyleState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.fontStyleState;onClicked: properties.fontStyleState = KoSvgTextPropertiesModel.PropertyUnset;}Label {@@ -132,7 +140,7 @@ CollapsibleGroupProperty {}RevertPropertyButton {- revertEnabled: properties.fontOpticalSizeLinkState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.fontOpticalSizeLinkState;onClicked: properties.fontOpticalSizeLinkState = KoSvgTextPropertiesModel.PropertyUnset;}Item {diff --git a/plugins/dockers/textproperties/qml/HangingPunctuation.qml b/plugins/dockers/textproperties/qml/HangingPunctuation.qmlindex d31cb75315..556352b2f7 100644--- a/plugins/dockers/textproperties/qml/HangingPunctuation.qml+++ b/plugins/dockers/textproperties/qml/HangingPunctuation.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label", "Hanging-punctuation");propertyType: TextPropertyBase.Paragraph;+ toolTip: i18nc("@info:tooltip",+ "Hanging punctuation allows hanging opening and closing punctuation as well as commas. This implementation only implements East-Asian style hanging punctuation.");+ searchTerms: i18nc("comma separated search terms for the hanging-punctuation property, matching is case-insensitive",+ "hanging-punctuation, burasagari");property alias hangStart: paragraphStartCbx.checked;property alias hangEnd: paragraphEndCbx.checked;property int hangComma: KoSvgTextPropertiesModel.NoHang;@@ -42,13 +46,16 @@ TextPropertyBase {properties.hangingPunctuationComma = hangComma}}++ onEnableProperty: properties.hangingPunctuationState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {columns: 2;columnSpacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.hangingPunctuationState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.hangingPunctuationState;onClicked: properties.hangingPunctuationState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/LetterSpacing.qml b/plugins/dockers/textproperties/qml/LetterSpacing.qmlindex 799747dfb5..6584976d75 100644--- a/plugins/dockers/textproperties/qml/LetterSpacing.qml+++ b/plugins/dockers/textproperties/qml/LetterSpacing.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label:spinbox", "Letter Spacing");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Letter spacing controls the spacing between visible clusters of characters.");+ searchTerms: i18nc("comma separated search terms for the letter-spacing property, matching is case-insensitive",+ "letter-spacing, tracking, kerning");property alias letterSpacing: letterSpacingSpn.value;property alias letterSpacingUnit: letterSpacingUnitCmb.comboBoxUnit;@@ -34,12 +38,14 @@ TextPropertyBase {}}+ onEnableProperty: properties.letterSpacingState = KoSvgTextPropertiesModel.PropertySet;+RowLayout {spacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.letterSpacingState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.letterSpacingState;onClicked: properties.letterSpacingState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/LineBreak.qml b/plugins/dockers/textproperties/qml/LineBreak.qmlindex ebd2d1d1d0..7a2bd5a451 100644--- a/plugins/dockers/textproperties/qml/LineBreak.qml+++ b/plugins/dockers/textproperties/qml/LineBreak.qml@@ -12,6 +12,10 @@ TextPropertyBase {property int breakType;propertyName: i18nc("@label:listbox", "Line Break");+ toolTip: i18nc("@info:tooltip",+ "Line Break allows choosing a strictness for the line breaking algorithm. Mostly used for CJK scripts, requires language being set.");+ searchTerms: i18nc("comma separated search terms for the line-break property, matching is case-insensitive",+ "line-break, line breaking, strictness, kinsoku");propertyType: TextPropertyBase.Character;onPropertiesUpdated: {@@ -28,12 +32,14 @@ TextPropertyBase {}}+ onEnableProperty: properties.lineBreakState = KoSvgTextPropertiesModel.PropertySet;+RowLayout {spacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.lineBreakState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.lineBreakState;onClicked: properties.lineBreakState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/LineHeight.qml b/plugins/dockers/textproperties/qml/LineHeight.qmlindex b1936b2bec..074342505d 100644--- a/plugins/dockers/textproperties/qml/LineHeight.qml+++ b/plugins/dockers/textproperties/qml/LineHeight.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label", "Line Height");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Line Height controls the line height used for the range of text.");+ searchTerms: i18nc("comma separated search terms for the line-height property, matching is case-insensitive",+ "line-height, line-spacing");property alias isNormal: lineHeightNormalCbx.checked;property alias lineHeight: lineHeightSpn.value;property int lineHeightUnit: LineHeightModel.Lines;@@ -42,13 +46,15 @@ TextPropertyBase {}}+ onEnableProperty: properties.lineHeightState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {columns: 3;columnSpacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.lineHeightState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.lineHeightState;onClicked: properties.lineHeightState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/RevertPropertyButton.qml b/plugins/dockers/textproperties/qml/RevertPropertyButton.qmlindex e0471c0091..0721c751e1 100644--- a/plugins/dockers/textproperties/qml/RevertPropertyButton.qml+++ b/plugins/dockers/textproperties/qml/RevertPropertyButton.qml@@ -5,12 +5,13 @@*/import QtQuick 2.15import QtQuick.Controls 2.0+import org.krita.flake.text 1.0Item {width: firstColumnWidth;height: firstColumnWidth;- property alias revertEnabled: revert.enabled;+ property int revertState: 0;property bool inheritable: true;signal clicked;@@ -18,7 +19,8 @@ Item {id: revert;icon.width: 22;icon.height: 22;- icon.color: sysPalette.text;+ icon.color: revertState === KoSvgTextPropertiesModel.PropertyTriState? sysPalette.highlight: sysPalette.text;+ enabled: revertState !== KoSvgTextPropertiesModel.PropertyUnset && revertState !== KoSvgTextPropertiesModel.PropertyInherited;opacity: enabled? 1.0: 0.5;display: AbstractButton.IconOnlyicon.source: parent.inheritable? "qrc:///light_edit-undo.svg": "qrc:///22_light_trash-empty.svg";diff --git a/plugins/dockers/textproperties/qml/TabSize.qml b/plugins/dockers/textproperties/qml/TabSize.qmlindex 7c3fcdf150..31b75438ad 100644--- a/plugins/dockers/textproperties/qml/TabSize.qml+++ b/plugins/dockers/textproperties/qml/TabSize.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@title:group", "Tab Size");propertyType: TextPropertyBase.Paragraph;+ toolTip: i18nc("@info:tooltip",+ "Tab Size allows defining the size of tabulation characters.");+ searchTerms: i18nc("comma separated search terms for the tab-size property, matching is case-insensitive",+ "tab-size");property alias tabSize: tabSizeSpn.value;property int tabSizeUnit: TabSizeModel.Spaces;@@ -35,6 +39,8 @@ TextPropertyBase {}}+ onEnableProperty: properties.tabSizeState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {columns: 3anchors.left: parent.left@@ -42,7 +48,7 @@ TextPropertyBase {columnSpacing: columnSpacing;RevertPropertyButton {- revertEnabled: properties.tabSizeState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.tabSizeState;onClicked: properties.tabSizeState = KoSvgTextPropertiesModel.PropertyUnset;}Label {diff --git a/plugins/dockers/textproperties/qml/TextAlign.qml b/plugins/dockers/textproperties/qml/TextAlign.qmlindex 9a85c54b36..724c6eef07 100644--- a/plugins/dockers/textproperties/qml/TextAlign.qml+++ b/plugins/dockers/textproperties/qml/TextAlign.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0CollapsibleGroupProperty {propertyName: i18nc("@title:group", "Text Align");propertyType: TextPropertyBase.Paragraph;+ toolTip: i18nc("@info:tooltip",+ "Text Align sets the alignment for the given block of characters.");+ searchTerms: i18nc("comma separated search terms for the text-anchor property, matching is case-insensitive",+ "text-align, justification, text-anchor");property int textAlignAll: 1;property int textAlignLast: 0;@@ -48,6 +52,8 @@ CollapsibleGroupProperty {}}+ onEnableProperty: properties.textAnchorState = KoSvgTextPropertiesModel.PropertySet;+contentItem: GridLayout {columns: 3anchors.left: parent.left@@ -55,7 +61,7 @@ CollapsibleGroupProperty {columnSpacing: columnSpacing;RevertPropertyButton {- revertEnabled: properties.textAlignAllState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.textAlignAllState;onClicked: properties.textAlignAllState = KoSvgTextPropertiesModel.PropertyUnset;}Label {@@ -82,7 +88,7 @@ CollapsibleGroupProperty {}RevertPropertyButton {- revertEnabled: properties.textAlignLastState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.textAlignLastState;onClicked: properties.textAlignLastState = KoSvgTextPropertiesModel.PropertyUnset;}Label {@@ -110,7 +116,7 @@ CollapsibleGroupProperty {RevertPropertyButton {- revertEnabled: properties.textAnchorState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.textAnchorState;onClicked: properties.textAnchorState = KoSvgTextPropertiesModel.PropertyUnset;}Label {diff --git a/plugins/dockers/textproperties/qml/TextDecoration.qml b/plugins/dockers/textproperties/qml/TextDecoration.qmlindex 4cee284ea4..0b50343778 100644--- a/plugins/dockers/textproperties/qml/TextDecoration.qml+++ b/plugins/dockers/textproperties/qml/TextDecoration.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@title:group", "Text Decoration");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Text Decoration allows drawing underlines, overlines and striking through text.");+ searchTerms: i18nc("comma separated search terms for the text-decoration property, matching is case-insensitive",+ "underline, overline, strikethrough, line-through");property alias underline: underlineCbx.checked;property alias overline: overlineCbx.checked;@@ -55,13 +59,17 @@ TextPropertyBase {}}+ onEnableProperty: {+ properties.textDecorationLineState = KoSvgTextPropertiesModel.PropertySet;+ }+GridLayout {columns: 3;columnSpacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.textDecorationLineState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.textDecorationLineState;inheritable: false;onClicked: properties.textDecorationLineState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/TextIndent.qml b/plugins/dockers/textproperties/qml/TextIndent.qmlindex c010c96d22..471b64c5d2 100644--- a/plugins/dockers/textproperties/qml/TextIndent.qml+++ b/plugins/dockers/textproperties/qml/TextIndent.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0CollapsibleGroupProperty {propertyName: i18nc("@title:group", "Text Indent");propertyType: TextPropertyBase.Paragraph;+ toolTip: i18nc("@info:tooltip",+ "Text Indent allows setting indentation at the line start. Only works when the text is wrapping.");+ searchTerms: i18nc("comma separated search terms for the text-indent property, matching is case-insensitive",+ "text-indent");property alias textIndentValue: textIndentSpn.value;property alias hanging: indentHangingCkb.checked;@@ -52,6 +56,8 @@ CollapsibleGroupProperty {}}+ onEnableProperty: properties.textIndentState = KoSvgTextPropertiesModel.PropertySet;+titleItem: RowLayout {spacing: columnSpacing;Layout.fillWidth: true;@@ -77,7 +83,7 @@ CollapsibleGroupProperty {columnSpacing: columnSpacing;RevertPropertyButton {- revertEnabled: properties.textIndentState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.textIndentState;onClicked: properties.textIndentState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/TextPropertyBase.qml b/plugins/dockers/textproperties/qml/TextPropertyBase.qmlindex 8be0d0949a..b5e4f9b36f 100644--- a/plugins/dockers/textproperties/qml/TextPropertyBase.qml+++ b/plugins/dockers/textproperties/qml/TextPropertyBase.qml@@ -23,13 +23,14 @@ Column {property KoSvgTextPropertiesModel properties : textPropertiesModel;signal propertiesUpdated; ///< Used by each text property panel to update the data on the controls.+ signal enableProperty; ///< Set the property to a default value.property bool blockSignals; ///< When setting the data on the controls, this needs to be enabled and checked while returning data from the controls.property string propertyName;property int propertyType;property int parentPropertyType;property string toolTip;- property var searchTerms: [];+ property string searchTerms;MenuSeparator {width: parent.width;diff --git a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qmlindex 7bdf7ad371..905b47c5d6 100644--- a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml+++ b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml@@ -15,6 +15,10 @@ ColumnLayout {id: propertyList;}+ ListModel {+ id: filteredPropertyList;+ }+Component.onCompleted: fillPropertyList();function fillPropertyList() {@@ -23,14 +27,35 @@ ColumnLayout {if (propertyWidgetModel.get(i).propertyType === propertyType ||propertyWidgetModel.get(i).propertyType === TextPropertyBase.Mixed) {propertyList.append({"name": propertyWidgetModel.get(i).propertyName,- "tooltip": propertyWidgetModel.get(i).toolTip,+ "toolTip": propertyWidgetModel.get(i).toolTip,"searchTerms": propertyWidgetModel.get(i).searchTerms,- "visible": propertyWidgetModel.get(i).visible,"item": propertyWidgetModel.get(i)});} else {propertyWidgetModel.get(i).visible = false;}}+ updateFilteredPropertyList();+ }++ signal filterChanged;++ onFilterChanged: {+ updateFilteredPropertyList();+ }++ function updateFilteredPropertyList() {+ filteredPropertyList.clear();+ for (var i = 0; i < propertyList.count; i++) {+ var searchText = propertySearch.text;+ if (searchText.length === 0) {+ filteredPropertyList.append(propertyList.get(i));+ } else {+ var searchTerms = propertyList.get(i).searchTerms.split(",");+ if (searchTerms.find(term => term.toLowerCase().includes(searchText.toLowerCase()))) {+ filteredPropertyList.append(propertyList.get(i));+ }+ }+ }}function updateProperties() {@@ -120,13 +145,72 @@ ColumnLayout {}ComboBox {+ id: addPropertyCmb;Layout.fillWidth: true;Layout.minimumHeight: implicitHeight;- model: propertyList;+ model: filteredPropertyList;textRole: "name";displayText: i18nc("@label:listbox", "Add Property");onActivated: {- model.get(currentIndex).item.visible = true;+ model.get(currentIndex).item.enableProperty();+ }+ onPopupChanged: if (!addPropertyCmb.popup.visible) { propertySearch.text = ""; }++ signal searchChanged;+ onSearchChanged: parent.filterChanged();++ delegate: ItemDelegate {+ id: addPropertyDelegate;+ width: addPropertyCmb.width;+ required property string name;+ required property int index;+ required property QtObject item;+ required property string toolTip;+ contentItem: Label {+ enabled: addPropertyDelegate.enabled;+ text: addPropertyDelegate.name;+ elide: Text.ElideRight+ verticalAlignment: Text.AlignVCenter+ }+ enabled: !item.visible;+ highlighted: addPropertyCmb.highlightedIndex === index;+ background: Rectangle { color: highlighted? parent.palette.highlight:"transparent"; }++ ToolTip.text: toolTip;+ ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval+ ToolTip.visible: highlighted;+ }++ popup: Popup {+ y: addPropertyCmb.height - 1;+ width: addPropertyCmb.width;+ height: childrenRect.height;+ padding: 1;++ contentItem: ColumnLayout {+ clip: true;+ width: parent.width;+ ListView {+ Layout.fillWidth: true;+ Layout.fillHeight: true;+ model: addPropertyCmb.popup.visible ? addPropertyCmb.delegateModel : null+ currentIndex: addPropertyCmb.highlightedIndex;++ ScrollBar.vertical: ScrollBar {+ }+ }+ MenuSeparator {+ Layout.fillWidth: true;+ Layout.preferredHeight: implicitHeight;+ }+ TextField {+ id: propertySearch;+ placeholderText: i18nc("@info:placeholder", "Search...");+ Layout.fillWidth: true;+ Layout.preferredHeight: implicitHeight;+ onTextChanged: addPropertyCmb.searchChanged();+ }+ }}}}diff --git a/plugins/dockers/textproperties/qml/TextTransform.qml b/plugins/dockers/textproperties/qml/TextTransform.qmlindex 99f6ed4952..ee2a1ecbb0 100644--- a/plugins/dockers/textproperties/qml/TextTransform.qml+++ b/plugins/dockers/textproperties/qml/TextTransform.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@title:group", "Text Transform");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Text Transform allows transforming the given range of characters, for example, by setting them uppercase, or switching out half-width forms for full-width forms.");+ searchTerms: i18nc("comma separated search terms for the text-transform property, matching is case-insensitive",+ "text-transform, uppercase, capitalization, lowercase, full-width, full-size kana");property alias fullWidth: fullWidthChk.checked;property alias fullSizeKana: fullSizeKanaChk.checked;property int capitals;@@ -43,13 +47,15 @@ TextPropertyBase {}}+ onEnableProperty: properties.textTransformState = KoSvgTextPropertiesModel.PropertySet;+GridLayout {columns: 3;columnSpacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.textTransformState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.textTransformState;onClicked: properties.textTransformState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/WordBreak.qml b/plugins/dockers/textproperties/qml/WordBreak.qmlindex 4d7b2ce12f..38d9d1db0f 100644--- a/plugins/dockers/textproperties/qml/WordBreak.qml+++ b/plugins/dockers/textproperties/qml/WordBreak.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label:listbox", "Word Break");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Word Break allows fine-tuning the line breaking by toggling whether to only break at words or also allow breaking at characters. Useful for Korean or Ethiopian.");+ searchTerms: i18nc("comma separated search terms for the word-break property, matching is case-insensitive",+ "word-break, line breaking");property int breakType;@@ -28,12 +32,14 @@ TextPropertyBase {}}+ onEnableProperty: properties.wordBreakState = KoSvgTextPropertiesModel.PropertySet;+RowLayout {spacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.wordBreakState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.wordBreakState;onClicked: properties.wordBreakState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/WordSpacing.qml b/plugins/dockers/textproperties/qml/WordSpacing.qmlindex e666d1df42..434a9742ae 100644--- a/plugins/dockers/textproperties/qml/WordSpacing.qml+++ b/plugins/dockers/textproperties/qml/WordSpacing.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@title:group", "Word Spacing");propertyType: TextPropertyBase.Character;+ toolTip: i18nc("@info:tooltip",+ "Word spacing controls the size of word-break characters, such as the space character.");+ searchTerms: i18nc("comma separated search terms for the word-spacing property, matching is case-insensitive",+ "word-spacing, tracking, white space,");property alias wordSpacing: wordSpacingSpn.value;visible: properties.wordSpacingState !== KoSvgTextPropertiesModel.PropertyUnset;property alias wordSpacingUnit: wordSpacingUnitCmb.comboBoxUnit;@@ -35,12 +39,14 @@ TextPropertyBase {}}+ onEnableProperty: properties.wordSpacingState = KoSvgTextPropertiesModel.PropertySet;+RowLayout {spacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.wordSpacingState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.wordSpacingState;onClicked: properties.wordSpacingState = KoSvgTextPropertiesModel.PropertyUnset;}diff --git a/plugins/dockers/textproperties/qml/WritingMode.qml b/plugins/dockers/textproperties/qml/WritingMode.qmlindex 5355cc1673..c022abb256 100644--- a/plugins/dockers/textproperties/qml/WritingMode.qml+++ b/plugins/dockers/textproperties/qml/WritingMode.qml@@ -11,6 +11,10 @@ import org.krita.flake.text 1.0TextPropertyBase {propertyName: i18nc("@label:listbox", "Writing Mode");propertyType: TextPropertyBase.Paragraph;+ toolTip: i18nc("@info:tooltip",+ "Writing Mode sets whether the text flows horizontally or vertically, and in the latter case, whether the block flows right to left or left to right.");+ searchTerms: i18nc("comma separated search terms for the writing-mode property, matching is case-insensitive",+ "writing-mode, horizontal, vertical, top-to-bottom");property int writingMode;onPropertiesUpdated: {@@ -27,12 +31,14 @@ TextPropertyBase {}}+ onEnableProperty: properties.writingModeState = KoSvgTextPropertiesModel.PropertySet;+RowLayout {spacing: columnSpacing;width: parent.width;RevertPropertyButton {- revertEnabled: properties.writingModeState === KoSvgTextPropertiesModel.PropertySet;+ revertState: properties.writingModeState;onClicked: properties.writingModeState = KoSvgTextPropertiesModel.PropertyUnset;}