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

Fix setting text properties on the docker, and improve sitation tristate properties.

Wolthera van Hövell tot Westerflier48af53617cba
diff --git a/plugins/dockers/textproperties/TextPropertiesDock.cpp b/plugins/dockers/textproperties/TextPropertiesDock.cpp
index 72fff135bd..982e084cdb 100644
--- a/plugins/dockers/textproperties/TextPropertiesDock.cpp
+++ b/plugins/dockers/textproperties/TextPropertiesDock.cpp
@@ -66,6 +66,7 @@ TextPropertiesDock::TextPropertiesDock()
QQuickStyle::setStyle(QStringLiteral("Fusion"));
}
+
m_quickWidget->engine()->addImportPath(KoResourcePaths::getApplicationRoot() + "/lib/qml/");
m_quickWidget->engine()->addImportPath(KoResourcePaths::getApplicationRoot() + "/lib64/qml/");
@@ -134,6 +135,7 @@ void TextPropertiesDock::slotCanvasResourcesChanged(int key, const QVariant &val
KoSvgTextPropertyData data = value.value<KoSvgTextPropertyData>();
if (d->textModel->textData.get() != data) {
d->textModel->textData.set(data);
+ QMetaObject::invokeMethod(m_quickWidget->rootObject(), "setProperties");
}
}
}
diff --git a/plugins/dockers/textproperties/qml/AlignmentBaseline.qml b/plugins/dockers/textproperties/qml/AlignmentBaseline.qml
index 6048c6ce52..9ba4ab1436 100644
--- a/plugins/dockers/textproperties/qml/AlignmentBaseline.qml
+++ b/plugins/dockers/textproperties/qml/AlignmentBaseline.qml
@@ -10,7 +10,20 @@ import org.krita.flake.text 1.0
TextPropertyBase {
property int baselineSelection;
- onBaselineSelectionChanged: baselineCmb.currentIndex = baselineCmb.indexOfValue(baselineSelection);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ baselineSelection = properties.alignmentBaseline;
+ blockSignals = false;
+ }
+
+ onBaselineSelectionChanged: {
+ baselineCmb.currentIndex = baselineCmb.indexOfValue(baselineSelection);
+ if (!blockSignals) {
+ properties.alignmentBaseline = baselineSelection;
+ }
+ }
+
GridLayout {
columns: 2;
columnSpacing: columnSpacing;
diff --git a/plugins/dockers/textproperties/qml/BaselineShift.qml b/plugins/dockers/textproperties/qml/BaselineShift.qml
index da23e3ab78..1ee07a2de5 100644
--- a/plugins/dockers/textproperties/qml/BaselineShift.qml
+++ b/plugins/dockers/textproperties/qml/BaselineShift.qml
@@ -11,9 +11,26 @@ import org.krita.flake.text 1.0
TextPropertyBase {
property alias baselineShiftValue: baselineShiftSpn.value;
property int baselineShiftMode;
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ baselineShiftValue = properties.baselineShiftValue.value;
+ baselineShiftMode = properties.baselineShiftMode;
+ blockSignals = false;
+ }
+
+ onBaselineShiftValueChanged: {
+ if (!blockSignals) {
+ properties.baselineShiftValue.value = baselineShiftValue;
+ }
+ }
+
onBaselineShiftModeChanged: {
baselineShiftCmb.currentIndex = baselineShiftCmb.indexOfValue(baselineShiftMode);
baselineShiftSpn.enabled = baselineShiftMode == 3;
+ if (!blockSignals) {
+ properties.baselineShiftMode = baselineShiftMode;
+ }
}
GridLayout {
diff --git a/plugins/dockers/textproperties/qml/Direction.qml b/plugins/dockers/textproperties/qml/Direction.qml
index ea88338ca9..674abc4211 100644
--- a/plugins/dockers/textproperties/qml/Direction.qml
+++ b/plugins/dockers/textproperties/qml/Direction.qml
@@ -10,7 +10,19 @@ import org.krita.flake.text 1.0
TextPropertyBase {
property int direction;
- onDirectionChanged: directionCmb.currentIndex = directionCmb.indexOfValue(direction)
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ direction = properties.direction;
+ blockSignals = false;
+ }
+
+ onDirectionChanged: {
+ directionCmb.currentIndex = directionCmb.indexOfValue(direction);
+ if (!blockSignals) {
+ properties.direction = direction;
+ }
+ }
RowLayout {
id: row
diff --git a/plugins/dockers/textproperties/qml/DominantBaseline.qml b/plugins/dockers/textproperties/qml/DominantBaseline.qml
index 32923ea8f8..8db9541d39 100644
--- a/plugins/dockers/textproperties/qml/DominantBaseline.qml
+++ b/plugins/dockers/textproperties/qml/DominantBaseline.qml
@@ -10,7 +10,20 @@ import org.krita.flake.text 1.0
TextPropertyBase {
property int baselineSelection
- onBaselineSelectionChanged: baselineCmb.currentIndex = baselineCmb.indexOfValue(baselineSelection);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ baselineSelection = properties.dominantBaseline;
+ blockSignals = false;
+ }
+
+ onBaselineSelectionChanged: {
+ baselineCmb.currentIndex = baselineCmb.indexOfValue(baselineSelection);
+ if (!blockSignals) {
+ properties.dominantBaseline = baselineSelection;
+ }
+ }
+
GridLayout {
columns: 2;
columnSpacing: columnSpacing;
diff --git a/plugins/dockers/textproperties/qml/FontFamily.qml b/plugins/dockers/textproperties/qml/FontFamily.qml
index a03ead54ce..f8c0ecbcf7 100644
--- a/plugins/dockers/textproperties/qml/FontFamily.qml
+++ b/plugins/dockers/textproperties/qml/FontFamily.qml
@@ -12,12 +12,23 @@ CollapsibleGroupProperty {
property var fontFamilies: [];
property var fontFamilyModel : [];
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ fontFamilies: properties.fontFamilies;
+ blockSignals = false;
+ }
+
onFontFamiliesChanged: {
- if (fontFamilies.length >0) {
- mainFamilyCmb.currentIndex = mainFamilyCmb.find(fontFamilies[0]);
+ if (blockSignals) {
+ if (fontFamilies.length >0) {
+ mainFamilyCmb.currentIndex = mainFamilyCmb.find(fontFamilies[0]);
+ }
+ familyListView.model = fontFamilies;
+ height: childrenRect.height;
+ } else {
+ properties.fontFamilies = fontFamilies;
}
- familyListView.model = fontFamilies;
- height: childrenRect.height;
}
titleItem: ComboBox {
diff --git a/plugins/dockers/textproperties/qml/FontSize.qml b/plugins/dockers/textproperties/qml/FontSize.qml
index 2a95d00812..97ae3c8e93 100644
--- a/plugins/dockers/textproperties/qml/FontSize.qml
+++ b/plugins/dockers/textproperties/qml/FontSize.qml
@@ -11,6 +11,17 @@ TextPropertyBase {
property alias fontSize: fontSizeSpn.value;
+ onPropertiesUpdated: {
+ blockSignals = true;
+ fontSize = properties.fontSize.value;
+ blockSignals = false;
+ }
+ onFontSizeChanged: {
+ if (!blockSignals) {
+ properties.fontSize.value = fontSize;
+ }
+ }
+
RowLayout {
spacing: columnSpacing;
width: parent.width;
diff --git a/plugins/dockers/textproperties/qml/FontStyle.qml b/plugins/dockers/textproperties/qml/FontStyle.qml
index 8a0b1d00cd..5ba0003d0d 100644
--- a/plugins/dockers/textproperties/qml/FontStyle.qml
+++ b/plugins/dockers/textproperties/qml/FontStyle.qml
@@ -14,9 +14,40 @@ CollapsibleGroupProperty {
property alias fontWeight: fontWeightSpn.value;
property alias fontWidth: fontStretchSpn.value;
property int fontSlant: KoSvgTextPropertiesModel.StyleNormal;
- onFontSlantChanged: fontSlantCmb.currentIndex = fontSlantCmb.indexOfValue(fontSlant)
+ onFontSlantChanged: {
+ fontSlantCmb.currentIndex = fontSlantCmb.indexOfValue(fontSlant);
+ if (!blockSignals) {
+ properties.fontStyle = fontSlant;
+ }
+ }
property alias fontOptical: opticalSizeCbx.checked;
+ onPropertiesUpdated: {
+ blockSignals = true;
+ fontWeight = properties.fontWeight;
+ fontWidth = properties.fontWidth;
+ fontOptical = properties.fontOpticalSizeLink;
+ fontSlant = properties.fontStyle;
+ blockSignals = false;
+ }
+ onFontWeightChanged: {
+ if (!blockSignals) {
+ properties.fontWeight = fontWeight;
+ }
+ }
+
+ onFontWidthChanged: {
+ if (!blockSignals) {
+ properties.fontWidth = fontWidth;
+ }
+ }
+
+ onFontOpticalChanged: {
+ if (!blockSignals) {
+ properties.fontOpticalSizeLink = fontOptical;
+ }
+ }
+
titleItem: ComboBox {
id: styleCmb;
Layout.fillWidth: true;
diff --git a/plugins/dockers/textproperties/qml/HangingPunctuation.qml b/plugins/dockers/textproperties/qml/HangingPunctuation.qml
index f7b7dadde7..03ed353c2c 100644
--- a/plugins/dockers/textproperties/qml/HangingPunctuation.qml
+++ b/plugins/dockers/textproperties/qml/HangingPunctuation.qml
@@ -12,7 +12,33 @@ TextPropertyBase {
property alias hangStart: paragraphStartCbx.checked;
property alias hangEnd: paragraphEndCbx.checked;
property int hangComma: KoSvgTextPropertiesModel.NoHang;
- onHangCommaChanged: lineEndCmb.currentIndex = lineEndCmb.indexOfValue(hangComma)
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ hangStart = properties.hangingPunctuationFirst;
+ hangEnd = properties.hangingPunctuationLast;
+ hangComma = properties.hangingPunctuationComma;
+ blockSignals = false;
+ }
+
+ onHangStartChanged: {
+ if (!blockSignals) {
+ properties.hangingPunctuationFirst = hangStart;
+ }
+ }
+
+ onHangEndChanged: {
+ if (!blockSignals) {
+ properties.hangingPunctuationLast = hangEnd;
+ }
+ }
+
+ onHangCommaChanged: {
+ lineEndCmb.currentIndex = lineEndCmb.indexOfValue(hangComma);
+ if (!blockSignals) {
+ properties.hangingPunctuationComma = hangComma
+ }
+ }
GridLayout {
columns: 2;
columnSpacing: columnSpacing;
diff --git a/plugins/dockers/textproperties/qml/LetterSpacing.qml b/plugins/dockers/textproperties/qml/LetterSpacing.qml
index 1b81e2e130..68b6914538 100644
--- a/plugins/dockers/textproperties/qml/LetterSpacing.qml
+++ b/plugins/dockers/textproperties/qml/LetterSpacing.qml
@@ -9,6 +9,18 @@ import QtQuick.Layouts 1.12
TextPropertyBase {
property alias letterSpacing: letterSpacingSpn.value;
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ letterSpacing = properties.letterSpacing.value;
+ blockSignals = false;
+ }
+ onLetterSpacingChanged: {
+ if (!blockSignals) {
+ properties.letterSpacing.value = letterSpacing;
+ }
+ }
+
RowLayout {
spacing: columnSpacing;
width: parent.width;
diff --git a/plugins/dockers/textproperties/qml/LineBreak.qml b/plugins/dockers/textproperties/qml/LineBreak.qml
index 52b0ce6a60..262b4186fe 100644
--- a/plugins/dockers/textproperties/qml/LineBreak.qml
+++ b/plugins/dockers/textproperties/qml/LineBreak.qml
@@ -10,7 +10,20 @@ import org.krita.flake.text 1.0
TextPropertyBase {
property int breakType;
- onBreakTypeChanged: lineBreakCmb.currentIndex = lineBreakCmb.indexOfValue(breakType);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ breakType = properties.lineBreak;
+ blockSignals = false;
+ }
+
+ onBreakTypeChanged: {
+ lineBreakCmb.currentIndex = lineBreakCmb.indexOfValue(breakType)
+ if (!blockSignals) {
+ properties.lineBreak = breakType;
+ }
+ }
+
RowLayout {
spacing: columnSpacing;
width: parent.width;
diff --git a/plugins/dockers/textproperties/qml/LineHeight.qml b/plugins/dockers/textproperties/qml/LineHeight.qml
index cd357f7d80..9060358be5 100644
--- a/plugins/dockers/textproperties/qml/LineHeight.qml
+++ b/plugins/dockers/textproperties/qml/LineHeight.qml
@@ -12,7 +12,32 @@ TextPropertyBase {
property alias isNormal: lineHeightNormalCbx.checked;
property alias lineHeight: lineHeightSpn.value;
property int lineHeightUnit: LineHeightModel.Lines;
- onLineHeightUnitChanged: lineHeightUnitCmb.currentIndex = lineHeightUnitCmb.indexOfValue(lineHeightUnit);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ isNormal = properties.lineHeight.isNormal;
+ lineHeight = properties.lineHeight.value;
+ lineHeightUnit = properties.lineHeight.unit;
+ blockSignals = false;
+ }
+
+ onLineHeightUnitChanged: {
+ lineHeightUnitCmb.currentIndex = lineHeightUnitCmb.indexOfValue(lineHeightUnit)
+ if (!blockSignals) {
+ properties.lineHeight.unit = lineHeightUnit
+ }
+ }
+ onIsNormalChanged: {
+ if (!blockSignals) {
+ properties.lineHeight.isNormal = isNormal;
+ }
+ }
+
+ onLineHeightChanged: {
+ if (!blockSignals) {
+ properties.lineHeight.value = lineHeight;
+ }
+ }
GridLayout {
columns: 3;
diff --git a/plugins/dockers/textproperties/qml/TabSize.qml b/plugins/dockers/textproperties/qml/TabSize.qml
index 4f02ec498e..aff0ec5eb7 100644
--- a/plugins/dockers/textproperties/qml/TabSize.qml
+++ b/plugins/dockers/textproperties/qml/TabSize.qml
@@ -12,7 +12,26 @@ TextPropertyBase {
property alias tabSize: tabSizeSpn.value;
property int tabSizeUnit: TabSizeModel.Spaces;
- onTabSizeUnitChanged: tabSizeUnitCmb.currentIndex = tabSizeUnitCmb.indexOfValue(tabSizeUnit);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ tabSize = properties.tabSize.value;
+ tabSizeUnit = properties.tabSize.unit;
+ blockSignals = false;
+ }
+
+ onTabSizeChanged: {
+ if (!blockSignals) {
+ properties.tabSize.value = tabSize;
+ }
+ }
+
+ onTabSizeUnitChanged: {
+ tabSizeUnitCmb.currentIndex = tabSizeUnitCmb.indexOfValue(tabSizeUnit);
+ if (!blockSignals) {
+ properties.tabSize.unit = tabSizeUnit;
+ }
+ }
GridLayout {
columns: 3
diff --git a/plugins/dockers/textproperties/qml/TextAlign.qml b/plugins/dockers/textproperties/qml/TextAlign.qml
index 7209382279..2278ecfcc0 100644
--- a/plugins/dockers/textproperties/qml/TextAlign.qml
+++ b/plugins/dockers/textproperties/qml/TextAlign.qml
@@ -9,14 +9,40 @@ import QtQuick.Layouts 1.12
import org.krita.flake.text 1.0
CollapsibleGroupProperty {
- propertyName: "Text Align";
+ propertyName: i18nc("@title:group", "Text Align");
property int textAlignAll: 1;
- onTextAlignAllChanged: textAlignAllCmb.currentIndex = textAlignAllCmb.indexOfValue(textAlignAll);
property int textAlignLast: 0;
- onTextAlignLastChanged: textAlignLastCmb.currentIndex = textAlignLastCmb.indexOfValue(textAlignLast);
property int textAnchor: 0;
- onTextAnchorChanged: textAnchorCmb.currentIndex = textAnchorCmb.indexOfValue(textAnchor);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ textAlignAll = properties.textAlignAll;
+ textAlignLast = properties.textAlignLast;
+ textAnchor = properties.textAnchor;
+ blockSignals = false;
+ }
+
+ onTextAlignAllChanged: {
+ textAlignAllCmb.currentIndex = textAlignAllCmb.indexOfValue(textAlignAll);
+ if (!blockSignals) {
+ properties.textAlignAll = textAlignAll;
+ }
+ }
+
+ onTextAlignLastChanged: {
+ textAlignLastCmb.currentIndex = textAlignLastCmb.indexOfValue(textAlignLast);
+ if (!blockSignals) {
+ properties.textAlignLast = textAlignLast;
+ }
+ }
+
+ onTextAnchorChanged: {
+ textAnchorCmb.currentIndex = textAnchorCmb.indexOfValue(textAnchor);
+ if (!blockSignals) {
+ properties.textAnchor = textAnchor;
+ }
+ }
contentItem: GridLayout {
columns: 3
diff --git a/plugins/dockers/textproperties/qml/TextDecoration.qml b/plugins/dockers/textproperties/qml/TextDecoration.qml
index 3113d4eae2..23e830cc6c 100644
--- a/plugins/dockers/textproperties/qml/TextDecoration.qml
+++ b/plugins/dockers/textproperties/qml/TextDecoration.qml
@@ -15,7 +15,42 @@ TextPropertyBase {
property alias linethrough: linethroughCbx.checked;
property int lineStyle;
property color lineColor;
- onLineStyleChanged: lineStyleCmb.currentIndex = lineStyleCmb.indexOfValue(lineStyle)
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ underline = properties.textDecorationUnderline;
+ overline = properties.textDecorationOverline;
+ linethrough = properties.textDecorationLineThrough;
+ lineStyle = properties.textDecorationStyle;
+ lineColor = properties.textDecorationColor;
+ blockSignals = false;
+ }
+
+ onLineStyleChanged: {
+ lineStyleCmb.currentIndex = lineStyleCmb.indexOfValue(lineStyle);
+ if (!blockSignals) {
+ properties.textDecorationStyle = lineStyle;
+ }
+ }
+
+ onUnderlineChanged: {
+ if (!blockSignals) {
+ properties.textDecorationUnderline = underline;
+ }
+ }
+
+ onOverlineChanged: {
+ if (!blockSignals) {
+ properties.textDecorationOverline = overline;
+ }
+ }
+
+ onLinethroughChanged: {
+ if (!blockSignals) {
+ properties.textDecorationLineThrough = linethrough;
+ }
+ }
+
GridLayout {
columns: 3;
columnSpacing: columnSpacing;
diff --git a/plugins/dockers/textproperties/qml/TextIndent.qml b/plugins/dockers/textproperties/qml/TextIndent.qml
index bff3674f79..44bb65800b 100644
--- a/plugins/dockers/textproperties/qml/TextIndent.qml
+++ b/plugins/dockers/textproperties/qml/TextIndent.qml
@@ -14,6 +14,32 @@ CollapsibleGroupProperty {
property alias hanging: indentHangingCkb.checked;
property alias eachLine: eachLineCkb.checked;
+ onPropertiesUpdated: {
+ blockSignals = true;
+ textIndentValue = properties.textIndent.length.value;
+ hanging = properties.textIndent.hanging;
+ eachLine = properties.textIndent.eachLine;
+ blockSignals = false;
+ }
+
+ onTextIndentValueChanged: {
+ if (!blockSignals) {
+ properties.textIndent.length.value = textIndentValue;
+ }
+ }
+
+ onHangingChanged: {
+ if (!blockSignals) {
+ properties.textIndent.hanging = hanging;
+ }
+ }
+
+ onEachLineChanged: {
+ if (!blockSignals) {
+ properties.textIndent.eachLine = eachLine;
+ }
+ }
+
titleItem: RowLayout {
spacing: columnSpacing;
Layout.fillWidth: true;
diff --git a/plugins/dockers/textproperties/qml/TextProperties.qml b/plugins/dockers/textproperties/qml/TextProperties.qml
index 7d92352130..2ec13c058d 100644
--- a/plugins/dockers/textproperties/qml/TextProperties.qml
+++ b/plugins/dockers/textproperties/qml/TextProperties.qml
@@ -20,6 +20,17 @@ Rectangle {
colorGroup: SystemPalette.Active
}
+ function setProperties() {
+ for (var i = 0; i < characterPropertiesModel.count; i++) {
+ characterPropertiesModel.get(i).properties = textPropertiesModel;
+ characterPropertiesModel.get(i).propertiesUpdated();
+ }
+ for (var l = 0; l < paragraphPropertiesModel.count; l++) {
+ paragraphPropertiesModel.get(l).properties = textPropertiesModel;
+ paragraphPropertiesModel.get(l).propertiesUpdated();
+ }
+ }
+
TabBar {
id: tabs
anchors.right: parent.right;
@@ -46,111 +57,47 @@ Rectangle {
border.color: sysPalette.base;
border.width: 1;
}
+ clip: true;
ListView {
id: characterProperties
model: ObjectModel {
+ id: characterPropertiesModel;
FontSize {
- width: characterProperties.width;
-
- fontSize: textPropertiesModel.fontSize.value;
- onFontSizeChanged: {textPropertiesModel.fontSize.value = fontSize;}
-
}
FontFamily {
- width: characterProperties.width;
- fontFamilies: textPropertiesModel.fontFamilies;
- onFontFamiliesChanged: textPropertiesModel.fontFamilies = fontFamilies;
fontFamilyModel: fontFamiliesModel;
}
FontStyle {
- width: characterProperties.width;
- fontWeight: textPropertiesModel.fontWeight;
- onFontWeightChanged: {textPropertiesModel.fontWeight = fontWeight;}
- fontWidth: textPropertiesModel.fontWidth;
- onFontWidthChanged: textPropertiesModel.fontWidth = fontWidth;
- fontSlant: textPropertiesModel.fontStyle;
- onFontSlantChanged: textPropertiesModel.fontStyle = fontSlant;
- fontOptical: textPropertiesModel.fontOpticalSizeLink;
- onFontOpticalChanged: textPropertiesModel.fontOpticalSizeLink = fontOptical;
}
LetterSpacing {
- width: characterProperties.width;
- letterSpacing: textPropertiesModel.letterSpacing.value;
- onLetterSpacingChanged: textPropertiesModel.letterSpacing.value = letterSpacing;
}
WordSpacing {
- width: characterProperties.width;
- wordSpacing: textPropertiesModel.wordSpacing.value;
- onWordSpacingChanged: textPropertiesModel.wordSpacing.value = wordSpacing;
}
LineHeight {
- width: characterProperties.width;
- isNormal: textPropertiesModel.lineHeight.isNormal;
- onIsNormalChanged: textPropertiesModel.lineHeight.isNormal = isNormal;
- lineHeight: textPropertiesModel.lineHeight.value;
- onLineHeightChanged: textPropertiesModel.lineHeight.value = lineHeight;
- lineHeightUnit: textPropertiesModel.lineHeight.unit;
- onLineHeightUnitChanged: textPropertiesModel.lineHeight.unit = lineHeightUnit;
}
LineBreak {
- width: characterProperties.width;
- breakType: textPropertiesModel.lineBreak;
- onBreakTypeChanged: textPropertiesModel.lineBreak = breakType;
}
WordBreak {
- width: characterProperties.width;
- breakType: textPropertiesModel.wordBreak;
- onBreakTypeChanged: textPropertiesModel.wordBreak = breakType;
}
TextTransform {
- width: characterProperties.width;
- fullWidth: textPropertiesModel.textTransform.fullWidth;
- onFullWidthChanged: textPropertiesModel.textTransform.fullWidth = fullWidth;
- fullSizeKana: textPropertiesModel.textTransform.fullSizeKana;
- onFullSizeKanaChanged: textPropertiesModel.textTransform.fullSizeKana = fullSizeKana;
- capitals: textPropertiesModel.textTransform.capitals;
- onCapitalsChanged: textPropertiesModel.textTransform.capitals = capitals;
}
TextDecoration {
- width: characterProperties.width;
- underline: textPropertiesModel.textDecorationUnderline;
- onUnderlineChanged: textPropertiesModel.textDecorationUnderline = underline;
- overline: textPropertiesModel.textDecorationOverline;
- onOverlineChanged: textPropertiesModel.textDecorationOverline = overline;
- linethrough: textPropertiesModel.textDecorationLineThrough;
- onLinethroughChanged: textPropertiesModel.textDecorationLineThrough = linethrough;
- lineStyle: textPropertiesModel.textDecorationStyle;
- onLineStyleChanged: textPropertiesModel.textDecorationStyle = lineStyle;
- lineColor: textPropertiesModel.textDecorationColor;
}
/*
OTLigatures {
- width: characterProperties.width;
}
OTPosition {
- width: characterProperties.width;
}
OTNumeric {
- width: characterProperties.width;
}
OTCaps {
- width: characterProperties.width;
}
OTEastAsian {
- width: characterProperties.width;
}*/
BaselineShift {
- width: characterProperties.width;
- baselineShiftValue: textPropertiesModel.baselineShiftValue.value;
- onBaselineShiftValueChanged: textPropertiesModel.baselineShiftValue.value = baselineShiftValue;
- baselineShiftMode: textPropertiesModel.baselineShiftMode;
- onBaselineShiftModeChanged: textPropertiesModel.baselineShiftMode = baselineShiftMode;
}
AlignmentBaseline {
- width: characterProperties.width;
- baselineSelection: textPropertiesModel.alignmentBaseline;
- onBaselineSelectionChanged: textPropertiesModel.alignmentBaseline = baselineSelection;
}
}
}
@@ -165,61 +112,25 @@ Rectangle {
ListView {
id: paragraphProperties
model: ObjectModel {
+ id: paragraphPropertiesModel;
WritingMode {
- width: parent.width;
- writingMode: textPropertiesModel.writingMode;
- onWritingModeChanged: {textPropertiesModel.writingMode = writingMode;}
}
Direction{
- width: parent.width;
- direction: textPropertiesModel.direction;
- onDirectionChanged: textPropertiesModel.direction = direction;
}
TextIndent{
- width: parent.width;
- textIndentValue: textPropertiesModel.textIndent.length.value;
- onTextIndentValueChanged: textPropertiesModel.textIndent.length.value = textIndentValue;
- hanging: textPropertiesModel.textIndent.hanging;
- onHangingChanged: textPropertiesModel.textIndent.hanging = hanging;
- eachLine: textPropertiesModel.textIndent.eachLine;
- onEachLineChanged: textPropertiesModel.textIndent.eachLine = eachLine;
}
TextAlign{
- width: parent.width;
- textAlignAll: textPropertiesModel.textAlignAll;
- onTextAlignAllChanged: textPropertiesModel.textAlignAll = textAlignAll;
- textAlignLast: textPropertiesModel.textAlignLast;
- onTextAlignLastChanged: textPropertiesModel.textAlignLast = textAlignLast;
- textAnchor: textPropertiesModel.textAnchor;
- onTextAnchorChanged: textPropertiesModel.textAnchor = textAnchor;
}
DominantBaseline {
- width: parent.width;
- baselineSelection: textPropertiesModel.dominantBaseline;
- onBaselineSelectionChanged: textPropertiesModel.dominantBaseline = baselineSelection;
}
/*
WhiteSpace {
- width: parent.width;
}
UnderlinePosition {
- width: parent.width;
}*/
HangingPunctuation {
- width: parent.width;
- hangStart: textPropertiesModel.hangingPunctuationFirst;
- onHangStartChanged: textPropertiesModel.hangingPunctuationFirst = hangStart;
- hangEnd: textPropertiesModel.hangingPunctuationLast;
- onHangEndChanged: textPropertiesModel.hangingPunctuationLast = hangEnd;
- hangComma: textPropertiesModel.hangingPunctuationComma;
- onHangCommaChanged: textPropertiesModel.hangingPunctuationComma = hangComma;
}
TabSize {
- width: parent.width;
- tabSize: textPropertiesModel.tabSize.value;
- onTabSizeChanged: textPropertiesModel.tabSize.value = tabSize;
- tabSizeUnit: textPropertiesModel.tabSize.unit;
- onTabSizeUnitChanged: textPropertiesModel.tabSize.unit = tabSizeUnit;
}
}
}
diff --git a/plugins/dockers/textproperties/qml/TextPropertyBase.qml b/plugins/dockers/textproperties/qml/TextPropertyBase.qml
index 3d77411bb3..2dbbf51205 100644
--- a/plugins/dockers/textproperties/qml/TextPropertyBase.qml
+++ b/plugins/dockers/textproperties/qml/TextPropertyBase.qml
@@ -4,10 +4,17 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
+import org.krita.flake.text 1.0
Column {
property int firstColumnWidth: 32;
property int columnSpacing: 5;
+ width: parent? parent.width: 100;
+
+ property KoSvgTextPropertiesModel properties;
+ signal propertiesUpdated; ///< Used by each text property panel to update the data on the controls.
+ property bool blockSignals; ///< When setting the data on the controls, this needs to be enabled and checked while returning data from the controls.
+
Rectangle {
color: sysPalette.base;
diff --git a/plugins/dockers/textproperties/qml/TextTransform.qml b/plugins/dockers/textproperties/qml/TextTransform.qml
index 01d307de93..a455aa1130 100644
--- a/plugins/dockers/textproperties/qml/TextTransform.qml
+++ b/plugins/dockers/textproperties/qml/TextTransform.qml
@@ -12,7 +12,34 @@ TextPropertyBase {
property alias fullWidth: fullWidthChk.checked;
property alias fullSizeKana: fullSizeKanaChk.checked;
property int capitals;
- onCapitalsChanged: textTransformCaseCmb.currentIndex = textTransformCaseCmb.indexOfValue(capitals);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ fullWidth = properties.textTransform.fullWidth;
+ fullSizeKana = properties.textTransform.fullSizeKana;
+ capitals = properties.textTransform.capitals;
+ blockSignals = false;
+ }
+
+ onCapitalsChanged: {
+ textTransformCaseCmb.currentIndex = textTransformCaseCmb.indexOfValue(capitals)
+ if (!blockSignals) {
+ properties.textTransform.capitals = capitals;
+ }
+ }
+
+ onFullWidthChanged: {
+ if (!blockSignals) {
+ properties.textTransform.fullWidth = fullWidth;
+ }
+ }
+
+ onFullSizeKanaChanged: {
+ if (!blockSignals) {
+ properties.textTransform.fullSizeKana = fullSizeKana;
+ }
+ }
+
GridLayout {
columns: 3;
columnSpacing: columnSpacing;
diff --git a/plugins/dockers/textproperties/qml/WordBreak.qml b/plugins/dockers/textproperties/qml/WordBreak.qml
index 95888c8ef3..f92be655f5 100644
--- a/plugins/dockers/textproperties/qml/WordBreak.qml
+++ b/plugins/dockers/textproperties/qml/WordBreak.qml
@@ -10,7 +10,20 @@ import org.krita.flake.text 1.0
TextPropertyBase {
property int breakType;
- onBreakTypeChanged: wordBreakCmb.currentIndex = wordBreakCmb.indexOfValue(breakType);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ breakType = properties.wordBreak;
+ blockSignals = false;
+ }
+
+ onBreakTypeChanged: {
+ wordBreakCmb.currentIndex = wordBreakCmb.indexOfValue(breakType)
+ if (!blockSignals) {
+ properties.wordBreak = breakType;
+ }
+ }
+
RowLayout {
spacing: columnSpacing;
width: parent.width;
diff --git a/plugins/dockers/textproperties/qml/WordSpacing.qml b/plugins/dockers/textproperties/qml/WordSpacing.qml
index 284b5e30a2..ce2d97d0d6 100644
--- a/plugins/dockers/textproperties/qml/WordSpacing.qml
+++ b/plugins/dockers/textproperties/qml/WordSpacing.qml
@@ -9,6 +9,18 @@ import QtQuick.Layouts 1.12
TextPropertyBase {
property alias wordSpacing: wordSpacingSpn.value
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ wordSpacing = properties.wordSpacing.value;
+ blockSignals = false;
+ }
+ onWordSpacingChanged: {
+ if (!blockSignals) {
+ properties.wordSpacing.value = wordSpacing;
+ }
+ }
+
RowLayout {
spacing: columnSpacing;
width: parent.width;
diff --git a/plugins/dockers/textproperties/qml/WritingMode.qml b/plugins/dockers/textproperties/qml/WritingMode.qml
index 85a90385d0..7a0b442f41 100644
--- a/plugins/dockers/textproperties/qml/WritingMode.qml
+++ b/plugins/dockers/textproperties/qml/WritingMode.qml
@@ -10,7 +10,19 @@ import org.krita.flake.text 1.0
TextPropertyBase {
property int writingMode;
- onWritingModeChanged: writingModeCmb.currentIndex = writingModeCmb.indexOfValue(writingMode);
+
+ onPropertiesUpdated: {
+ blockSignals = true;
+ writingMode = properties.writingMode;
+ blockSignals = false;
+ }
+
+ onWritingModeChanged: {
+ writingModeCmb.currentIndex = writingModeCmb.indexOfValue(writingMode)
+ if (!blockSignals) {
+ properties.writingMode = writingMode;
+ }
+ }
RowLayout {
spacing: columnSpacing;