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

Set all sliders in text properties docker to block updates while dragging.

Wolthera van Hövell tot Westerflier7643f16783ca
diff --git a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp b/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp
index f3641dc9fb..452563d34f 100644
--- a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp
+++ b/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp
@@ -58,7 +58,7 @@ auto simplifiedAutoLengthPropertyImpl = lager::lenses::getset(
return length.isAuto? KoSvgText::CssLengthPercentage(): length.length;
},
[](KoSvgText::AutoLengthPercentage length, const KoSvgText::CssLengthPercentage &val){
- length = val; return length;
+ length.length = val; length.isAuto = false; return length;
}
);
@@ -86,7 +86,7 @@ auto autoValueSimplifiedImpl = lager::lenses::getset(
return value.isAuto? 0.0: value.customValue;
},
[](KoSvgText::AutoValue value, const qreal &val){
- value.customValue = val;
+ value.customValue = val < 0? 0: val;
value.isAuto = value.customValue > 0? false: true;
return value;
}
diff --git a/plugins/dockers/textproperties/qml/FontSize.qml b/plugins/dockers/textproperties/qml/FontSize.qml
index a9fa8f12d5..f1adc95f12 100644
--- a/plugins/dockers/textproperties/qml/FontSize.qml
+++ b/plugins/dockers/textproperties/qml/FontSize.qml
@@ -54,7 +54,7 @@ TextPropertyBase {
}
function updateFontSize() {
- if (!fontSizeSpn.isDragging) {
+ if (!fontSizeSpn.dragging) {
blockSignals = true;
fontSizeUnitCmb.setDataValueAndUnit(properties.fontSize.value, properties.fontSize.unitType);
blockSignals = false;
@@ -98,7 +98,7 @@ TextPropertyBase {
softDFrom: 0;
softDTo: 72;
softRangeActive: true;
- //blockUpdateSignalOnDrag: true;
+ blockUpdateSignalOnDrag: true;
onDValueChanged: fontSizeUnitCmb.userValue = dValue;
}
diff --git a/plugins/dockers/textproperties/qml/FontSizeAdjust.qml b/plugins/dockers/textproperties/qml/FontSizeAdjust.qml
index d013e1b0a5..754faeb382 100644
--- a/plugins/dockers/textproperties/qml/FontSizeAdjust.qml
+++ b/plugins/dockers/textproperties/qml/FontSizeAdjust.qml
@@ -69,15 +69,15 @@ TextPropertyBase {
Kis.DoubleSliderSpinBox {
id: fontSizeAdjustSpn
prefix: propertyTitle+ ": "
- softDFrom: 0
- softDTo: 1
+ softDFrom: 0;
+ softDTo: 1;
dFrom: 0;
dTo: 5;
softRangeActive: true
dStepSize: 0.1;
Layout.preferredWidth: implicitWidth;
Layout.fillWidth: true;
- //blockUpdateSignalOnDrag: true;
+ blockUpdateSignalOnDrag: true;
}
Button {
@@ -85,7 +85,7 @@ TextPropertyBase {
ToolTip.text: i18nc("@info:tooltip", "Calculate the x-height to font size ratio for the first font family.");
onClicked: {
let ratio = properties.resolvedXHeight(true)/properties.resolvedFontSize(true);
- fontSizeAdjust = ratio * fontSizeAdjustSpn.multiplier;
+ fontSizeAdjust = ratio;
}
}
}
diff --git a/plugins/dockers/textproperties/qml/FontStyle.qml b/plugins/dockers/textproperties/qml/FontStyle.qml
index 9f8c409bf7..0fc0ddc066 100644
--- a/plugins/dockers/textproperties/qml/FontStyle.qml
+++ b/plugins/dockers/textproperties/qml/FontStyle.qml
@@ -77,6 +77,29 @@ CollapsibleGroupProperty {
function onFontFamiliesChanged() {
updateAxisAndStyle();
}
+
+ function onFontWeightStateChanged() {
+ updateVisibility();
+ }
+ function onFontStyleStateChanged() {
+ updateVisibility();
+ }
+ function onFontWidthStateChanged() {
+ updateVisibility();
+ }
+ function onFontOpticalSizeLinkStateChanged() {
+ updateVisibility();
+ }
+ function onFontSynthesisStyleStateChanged() {
+ updateVisibility();
+ }
+ function onFontSynthesisWeightStateChanged() {
+ updateVisibility();
+ }
+
+ function onAxisValuesStateChanged() {
+ updateVisibility();
+ }
}
onPropertiesChanged: {
updateWeight();
@@ -90,7 +113,7 @@ CollapsibleGroupProperty {
}
function updateWeight() {
- if (!fontWeightSpn.isDragging) {
+ if (!fontWeightSpn.dragging) {
blockSignals = true;
fontWeight = properties.fontWeight;
blockSignals = false;
@@ -98,7 +121,7 @@ CollapsibleGroupProperty {
}
function updateSlant() {
- if (!fontSlantSpn.isDragging) {
+ if (!fontSlantSpn.dragging) {
blockSignals = true;
fontSlant = properties.fontStyle.style;
fontSlantSlope = properties.fontStyle.value;
@@ -107,7 +130,7 @@ CollapsibleGroupProperty {
}
function updateWidth() {
- if (!fontStretchSpn.isDragging) {
+ if (!fontStretchSpn.dragging) {
blockSignals = true;
fontWidth = properties.fontWidth;
blockSignals = false;
@@ -151,7 +174,6 @@ CollapsibleGroupProperty {
properties.fontStyleState,
properties.fontWidthState,
properties.fontOpticalSizeLinkState,
- properties.axisValueState,
properties.fontSynthesisStyleState,
properties.fontSynthesisWeightState,
properties.axisValuesState
@@ -257,6 +279,7 @@ CollapsibleGroupProperty {
to: 1000;
Layout.fillWidth: true;
Layout.columnSpan: 2;
+ blockUpdateSignalOnDrag: true;
}
RevertPropertyButton {
@@ -287,6 +310,7 @@ CollapsibleGroupProperty {
to: 200;
Layout.fillWidth: true;
Layout.columnSpan: 2;
+ blockUpdateSignalOnDrag: true;
}
RevertPropertyButton {
@@ -338,7 +362,7 @@ CollapsibleGroupProperty {
anchors.fill: parent;
palette: slantSpnPal.palette;
- wheelEnabled: true;
+ blockUpdateSignalOnDrag: true;
}
onClicked: {
diff --git a/plugins/dockers/textproperties/qml/LetterSpacing.qml b/plugins/dockers/textproperties/qml/LetterSpacing.qml
index f2464d74c7..a3b63687da 100644
--- a/plugins/dockers/textproperties/qml/LetterSpacing.qml
+++ b/plugins/dockers/textproperties/qml/LetterSpacing.qml
@@ -55,7 +55,7 @@ TextPropertyBase {
}
function updateLetterSpacing() {
- if (!letterSpacingSpn.isDragging) {
+ if (!letterSpacingSpn.dragging) {
blockSignals = true;
letterSpacingUnitCmb.setDataValueAndUnit(properties.letterSpacing.value, properties.letterSpacing.unitType);
blockSignals = false;
diff --git a/plugins/dockers/textproperties/qml/WordSpacing.qml b/plugins/dockers/textproperties/qml/WordSpacing.qml
index 79d76767ed..741fe949f2 100644
--- a/plugins/dockers/textproperties/qml/WordSpacing.qml
+++ b/plugins/dockers/textproperties/qml/WordSpacing.qml
@@ -55,7 +55,7 @@ TextPropertyBase {
}
function updateWordSpacing() {
- if (!wordSpacingSpn.isDragging) {
+ if (!wordSpacingSpn.dragging) {
blockSignals = true;
wordSpacingUnitCmb.setDataValueAndUnit(properties.wordSpacing.value, properties.wordSpacing.unitType);
blockSignals = false;