diff options
author | Henning Gruendl <henning.gruendl@qt.io> | 2022-11-25 17:47:49 +0100 |
---|---|---|
committer | Henning Gruendl <henning.gruendl@qt.io> | 2022-11-28 12:45:23 +0100 |
commit | eef765c5ed34eac8c1294fbeda55d273f916ca86 (patch) | |
tree | 09d25fdaf312288d84f8eed3874a2405b7529e09 | |
parent | 728b7a681e4a6243f28af61dd84aa1ceddd80144 (diff) |
Store previous strokeWidth to re-use when shown
Store the previously set strokeWidth on all ShapePath related item
specifics. This allows to revert to the previous value when stroke is
hidden and shown again.
Task-number: QDS-8191
Change-Id: Iea68e6dd726ce3fea8aedbe268b1822e0d7d19ea
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
8 files changed, 129 insertions, 74 deletions
diff --git a/src/imports/components/designer/ArcItemSpecifics.qml b/src/imports/components/designer/ArcItemSpecifics.qml index 28508dd..7f61a1d 100644 --- a/src/imports/components/designer/ArcItemSpecifics.qml +++ b/src/imports/components/designer/ArcItemSpecifics.qml @@ -62,6 +62,7 @@ Column { SecondColumnLayout { SpinBox { + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth backendValue: backendValues.strokeWidth @@ -69,6 +70,16 @@ Column { minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -77,19 +88,14 @@ Column { } CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") implicitWidth: StudioTheme.Values.twoControlColumnWidth - backendValue: backendValues.strokeWidth.value - checked: (backendValues.strokeWidth.value >= 0 ? false : true) + checked: (backendValues.strokeWidth.value < 0) actionIndicator.visible: false - onCheckedChanged: { - if (strokeWidthCheck.checked === true) - backendValues.strokeWidth.value = -1 - else - backendValues.strokeWidth.value = ((backendValues.strokeWidth.value < 0) ? 4 : backendValues.strokeWidth.value) - } + onCheckedChanged: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} diff --git a/src/imports/components/designer/BorderItemSpecifics.qml b/src/imports/components/designer/BorderItemSpecifics.qml index 38bcf48..7927c78 100644 --- a/src/imports/components/designer/BorderItemSpecifics.qml +++ b/src/imports/components/designer/BorderItemSpecifics.qml @@ -53,14 +53,24 @@ Column { SecondColumnLayout { SpinBox { - id: strokeWidthSpin - backendValue: backendValues.strokeWidth + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth + backendValue: backendValues.strokeWidth decimals: 1 minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -69,18 +79,14 @@ Column { } CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") - checked: (backendValues.strokeWidth.value >= 0 ? false : true) - actionIndicator.visible: false implicitWidth: StudioTheme.Values.twoControlColumnWidth + checked: (backendValues.strokeWidth.value < 0) + actionIndicator.visible: false - onCheckedChanged: { - if (strokeWidthCheck.checked === true) - backendValues.strokeWidth.value = -1 - else - backendValues.strokeWidth.value = ((backendValues.strokeWidth.value < 0) ? 4 : backendValues.strokeWidth.value) - } + onCheckedChanged: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} diff --git a/src/imports/components/designer/EllipseItemSpecifics.qml b/src/imports/components/designer/EllipseItemSpecifics.qml index 541c509..5ff80f5 100644 --- a/src/imports/components/designer/EllipseItemSpecifics.qml +++ b/src/imports/components/designer/EllipseItemSpecifics.qml @@ -61,7 +61,7 @@ Column { SecondColumnLayout { SpinBox { - id: strokeWidthSpin + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth backendValue: backendValues.strokeWidth @@ -69,6 +69,16 @@ Column { minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -77,18 +87,14 @@ Column { } CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") - checked: (backendValues.strokeWidth.value >= 0 ? false : true) - actionIndicator.visible: false implicitWidth: StudioTheme.Values.twoControlColumnWidth + checked: (backendValues.strokeWidth.value < 0) + actionIndicator.visible: false - onCheckedChanged: { - if (strokeWidthCheck.checked === true) - backendValues.strokeWidth.value = -1 - else - backendValues.strokeWidth.value = ((backendValues.strokeWidth.value < 0) ? 4 : backendValues.strokeWidth.value) - } + onCheckedChanged: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} diff --git a/src/imports/components/designer/PieItemSpecifics.qml b/src/imports/components/designer/PieItemSpecifics.qml index 7bd7b7c..b549914 100644 --- a/src/imports/components/designer/PieItemSpecifics.qml +++ b/src/imports/components/designer/PieItemSpecifics.qml @@ -61,14 +61,24 @@ Column { SecondColumnLayout { SpinBox { - id: strokeWidthSpin - backendValue: backendValues.strokeWidth + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth + backendValue: backendValues.strokeWidth decimals: 1 minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -77,18 +87,14 @@ Column { } CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") - checked: (backendValues.strokeWidth.value >= 0 ? false : true) - actionIndicator.visible: false implicitWidth: StudioTheme.Values.twoControlColumnWidth + checked: (backendValues.strokeWidth.value < 0) + actionIndicator.visible: false - onCheckedChanged: { - if (strokeWidthCheck.checked === true) - backendValues.strokeWidth.value = -1 - else - backendValues.strokeWidth.value = ((backendValues.strokeWidth.value < 0) ? 4 : backendValues.strokeWidth.value) - } + onCheckedChanged: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} diff --git a/src/imports/components/designer/RectangleItemSpecifics.qml b/src/imports/components/designer/RectangleItemSpecifics.qml index b9ce90e..0af8eeb 100644 --- a/src/imports/components/designer/RectangleItemSpecifics.qml +++ b/src/imports/components/designer/RectangleItemSpecifics.qml @@ -61,7 +61,7 @@ Column { SecondColumnLayout { SpinBox { - id: strokeWidthSpin + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth backendValue: backendValues.strokeWidth @@ -69,6 +69,16 @@ Column { minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -77,18 +87,14 @@ Column { } CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") - checked: (backendValues.strokeWidth.value >= 0 ? false : true) - actionIndicator.visible: false implicitWidth: StudioTheme.Values.twoControlColumnWidth + checked: (backendValues.strokeWidth.value < 0) + actionIndicator.visible: false - onCheckedChanged: { - if (strokeWidthCheck.checked === true) - backendValues.strokeWidth.value = -1 - else - backendValues.strokeWidth.value = ((backendValues.strokeWidth.value < 0) ? 4 : backendValues.strokeWidth.value) - } + onCheckedChanged: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} diff --git a/src/imports/components/designer/RegularPolygonItemSpecifics.qml b/src/imports/components/designer/RegularPolygonItemSpecifics.qml index 33cc02e..772db0d 100644 --- a/src/imports/components/designer/RegularPolygonItemSpecifics.qml +++ b/src/imports/components/designer/RegularPolygonItemSpecifics.qml @@ -61,7 +61,7 @@ Column { SecondColumnLayout { SpinBox { - id: strokeWidthSpin + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth backendValue: backendValues.strokeWidth @@ -69,6 +69,16 @@ Column { minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -77,18 +87,14 @@ Column { } CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") - checked: (backendValues.strokeWidth.value >= 0 ? false : true) - actionIndicator.visible: false implicitWidth: StudioTheme.Values.twoControlColumnWidth + checked: (backendValues.strokeWidth.value < 0) + actionIndicator.visible: false - onCheckedChanged: { - if (strokeWidthCheck.checked === true) - backendValues.strokeWidth.value = -1 - else - backendValues.strokeWidth.value = ((backendValues.strokeWidth.value < 0) ? 4 : backendValues.strokeWidth.value) - } + onCheckedChanged: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} diff --git a/src/imports/components/designer/SvgPathItemSpecifics.qml b/src/imports/components/designer/SvgPathItemSpecifics.qml index 77b7875..9cbc47f 100644 --- a/src/imports/components/designer/SvgPathItemSpecifics.qml +++ b/src/imports/components/designer/SvgPathItemSpecifics.qml @@ -62,6 +62,7 @@ Column { SecondColumnLayout { SpinBox { + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth backendValue: backendValues.strokeWidth @@ -69,6 +70,16 @@ Column { minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -77,13 +88,14 @@ Column { } StudioControls.CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") - checked: backendValues.strokeWidth.value < 0 - actionIndicator.visible: false implicitWidth: StudioTheme.Values.twoControlColumnWidth + checked: (backendValues.strokeWidth.value < 0) + actionIndicator.visible: false - onClicked: backendValues.strokeWidth.value = strokeWidthCheck.checked ? -1 : 4 + onClicked: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} diff --git a/src/imports/components/designer/TriangleItemSpecifics.qml b/src/imports/components/designer/TriangleItemSpecifics.qml index bbd419a..8a2308e 100644 --- a/src/imports/components/designer/TriangleItemSpecifics.qml +++ b/src/imports/components/designer/TriangleItemSpecifics.qml @@ -65,6 +65,7 @@ Column { SecondColumnLayout { SpinBox { + id: strokeWidthSpinBox implicitWidth: StudioTheme.Values.twoControlColumnWidth + StudioTheme.Values.actionIndicatorWidth backendValue: backendValues.strokeWidth @@ -72,6 +73,16 @@ Column { minimumValue: -1 maximumValue: 200 stepSize: 1 + + property real previousValue: 0 + + onValueChanged: { + if (strokeWidthSpinBox.value > 0) + strokeWidthSpinBox.previousValue = strokeWidthSpinBox.value + } + + Component.onCompleted: strokeWidthSpinBox.previousValue + = Math.max(1, backendValues.strokeWidth.value) } Spacer { @@ -80,18 +91,14 @@ Column { } CheckBox { - id: strokeWidthCheck + id: strokeWidthCheckBox text: qsTr("Hide") - checked: (backendValues.strokeWidth.value >= 0 ? false : true) - actionIndicator.visible: false implicitWidth: StudioTheme.Values.twoControlColumnWidth + checked: (backendValues.strokeWidth.value < 0) + actionIndicator.visible: false - onCheckedChanged: { - if (strokeWidthCheck.checked === true) - backendValues.strokeWidth.value = -1 - else - backendValues.strokeWidth.value = ((backendValues.strokeWidth.value < 0) ? 4 : backendValues.strokeWidth.value) - } + onCheckedChanged: backendValues.strokeWidth.value + = (strokeWidthCheckBox.checked ? -1 : strokeWidthSpinBox.previousValue) } ExpandingSpacer {} |