Commit 9ae4021e authored by Ismael Asensio's avatar Ismael Asensio Committed by Nate Graham
Browse files

[kwinrules] Allow negative numbers in position

This was limited by the range of the edition spinbox, not by the
rules mechanism which already allowed it.

BUG: 428083


(cherry picked from commit 3d80665c)
parent 6577a35e
......@@ -142,8 +142,9 @@ Loader {
id: coordItem
spacing: Kirigami.Units.smallSpacing
readonly property var coord: (controlType == RuleItem.Size) ? Qt.size(coordX.value, coordY.value)
: Qt.point(coordX.value, coordY.value)
readonly property bool isSize: controlType == RuleItem.Size
readonly property var coord: (isSize) ? Qt.size(coordX.value, coordY.value)
: Qt.point(coordX.value, coordY.value)
onCoordChanged: valueEditor.valueEdited(coord)
QQC2.SpinBox {
......@@ -151,9 +152,9 @@ Loader {
editable: true
Layout.preferredWidth: 50 // 50%
Layout.fillWidth: true
from: 0
from: (isSize) ? 0 : -32767
to: 32767
value: (controlType == RuleItem.Size) ? ruleValue.width : ruleValue.x
value: (isSize) ? ruleValue.width : ruleValue.x
}
QQC2.Label {
id: coordSeparator
......@@ -164,11 +165,11 @@ Loader {
QQC2.SpinBox {
id: coordY
editable: true
from: 0
to: 32767
from: coordX.from
to: coordX.to
Layout.preferredWidth: 50 // 50%
Layout.fillWidth: true
value: (controlType == RuleItem.Size) ? ruleValue.height : ruleValue.y
value: (isSize) ? ruleValue.height : ruleValue.y
}
}
}
......
......@@ -208,8 +208,10 @@ QVariant RuleItem::typedValue(const QVariant &value) const
}
return typesMask;
}
case Point:
return value.toPoint();
case Point: {
const QPoint point = value.toPoint();
return (point == invalidPoint) ? QPoint(0, 0) : point;
}
case Size:
return value.toSize();
case String:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment