summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/AnchorText.qml17
-rw-r--r--widgets/PaddedRect.qml (renamed from widgets/Box.qml)36
-rw-r--r--widgets/StyledRect.qml41
3 files changed, 59 insertions, 35 deletions
diff --git a/widgets/AnchorText.qml b/widgets/AnchorText.qml
new file mode 100644
index 0000000..a0342e8
--- /dev/null
+++ b/widgets/AnchorText.qml
@@ -0,0 +1,17 @@
+import "root:/config"
+import QtQuick
+
+StyledText {
+ id: root
+
+ required property Item prevAnchor
+ property bool vertical
+
+ anchors.left: vertical ? undefined : prevAnchor.right
+ anchors.leftMargin: vertical ? 0 : Appearance.padding.smaller
+ anchors.top: vertical ? prevAnchor.bottom : undefined
+ anchors.topMargin: vertical ? Appearance.padding.smaller : 0
+
+ anchors.horizontalCenter: vertical ? prevAnchor.horizontalCenter : undefined
+ anchors.verticalCenter: vertical ? undefined : prevAnchor.verticalCenter
+}
diff --git a/widgets/Box.qml b/widgets/PaddedRect.qml
index d93fb69..382360d 100644
--- a/widgets/Box.qml
+++ b/widgets/PaddedRect.qml
@@ -1,13 +1,9 @@
import "root:/config"
import QtQuick
-Rectangle {
+StyledRect {
id: root
- property bool vertical: false
- property bool homogenous: false
- property bool animated: false
- property int spacing: Appearance.spacing.small
property var padding: 0
readonly property int paddingTop: getRealPadding().top
@@ -44,8 +40,6 @@ Rectangle {
return pad;
}
- color: "transparent"
-
implicitWidth: childrenRect.width + paddingX
implicitHeight: childrenRect.height + paddingY
@@ -55,32 +49,4 @@ Rectangle {
child.y = Qt.binding(() => paddingTop);
}
}
-
- Behavior on color {
- ColorAnimation {
- duration: Appearance.anim.durations.normal
- easing.type: Easing.BezierSpline
- easing.bezierCurve: Appearance.anim.curves.standard
- }
- }
-
- Behavior on implicitWidth {
- enabled: root.animated
-
- NumberAnimation {
- duration: Appearance.anim.durations.normal
- easing.type: Easing.BezierSpline
- easing.bezierCurve: Appearance.anim.curves.emphasized
- }
- }
-
- Behavior on implicitHeight {
- enabled: root.animated
-
- NumberAnimation {
- duration: Appearance.anim.durations.normal
- easing.type: Easing.BezierSpline
- easing.bezierCurve: Appearance.anim.curves.emphasized
- }
- }
}
diff --git a/widgets/StyledRect.qml b/widgets/StyledRect.qml
new file mode 100644
index 0000000..f9d6ad1
--- /dev/null
+++ b/widgets/StyledRect.qml
@@ -0,0 +1,41 @@
+import "root:/config"
+import QtQuick
+
+Rectangle {
+ id: root
+
+ property bool animated: false
+ property bool vertical: false // Convenience property for propagation to children
+
+ color: "transparent"
+ implicitWidth: childrenRect.width
+ implicitHeight: childrenRect.height
+
+ Behavior on color {
+ ColorAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.standard
+ }
+ }
+
+ Behavior on implicitWidth {
+ enabled: root.animated
+
+ NumberAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.emphasized
+ }
+ }
+
+ Behavior on implicitHeight {
+ enabled: root.animated
+
+ NumberAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.emphasized
+ }
+ }
+}