diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-16 14:54:53 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-16 14:54:53 +0800 |
| commit | 5109ebe7179ced7107f4152e585423782ccb826b (patch) | |
| tree | 59b8020e0351d0abd43c985c73128ea166283cda /bar/TimeDate.qml | |
| parent | b147652efdcbc1a3408d20c6e02606163725452a (diff) | |
Resources: alt texts
Diffstat (limited to 'bar/TimeDate.qml')
| -rw-r--r-- | bar/TimeDate.qml | 112 |
1 files changed, 77 insertions, 35 deletions
diff --git a/bar/TimeDate.qml b/bar/TimeDate.qml index 5844aab..dddd71c 100644 --- a/bar/TimeDate.qml +++ b/bar/TimeDate.qml @@ -6,6 +6,9 @@ import qs.components import qs.config Item { + id: root + property bool isAlt: false + implicitWidth: container.implicitWidth implicitHeight: container.implicitHeight - General.rectMargin Rectangle { @@ -16,51 +19,90 @@ Item { horizontalCenter: parent.horizontalCenter } - implicitWidth: layout.implicitWidth + General.rectMargin * 2 + implicitWidth: !isAlt ? nonAlt.implicitWidth + General.rectMargin * 2 : alt.implicitWidth + General.rectMargin * 2 implicitHeight: Bar.height color: WallustColors.color4 radius: Style.rounding.large - RowLayout { - id: layout - Item { - Layout.fillWidth: true - } + Loader { + id: nonAlt anchors.fill: parent - spacing: Bar.resourceIconTextSpacing + active: !root.isAlt + sourceComponent: Component { + RowLayout { + Item { + Layout.fillWidth: true + } + anchors.fill: parent + spacing: Bar.resourceIconTextSpacing - Icon { - text: Icons.resource.clock - font.pixelSize: Style.font.size.larger - } - RowLayout { - property int h: Services.TimeDate.hours - property int m: Services.TimeDate.minutes - property int s: Services.TimeDate.seconds - spacing: 0 - IText { - animate: true - text: (parent.h >= 10 ? "" : "0") + parent.h - } - IText { - text: ":" - } - IText { - animate: true - text: (parent.m >= 10 ? "" : "0") + parent.m - } - IText { - text: ":" - } - IText { - animate: true - text: (parent.s >= 10 ? "" : "0") + parent.s + Icon { + text: Icons.resource.clock + font.pixelSize: Style.font.size.larger + } + RowLayout { + property int h: Services.TimeDate.hours + property int m: Services.TimeDate.minutes + property int s: Services.TimeDate.seconds + spacing: 0 + IText { + animate: true + text: (parent.h >= 10 ? "" : "0") + parent.h + } + IText { + text: ":" + } + IText { + animate: true + text: (parent.m >= 10 ? "" : "0") + parent.m + } + IText { + text: ":" + } + IText { + animate: true + text: (parent.s >= 10 ? "" : "0") + parent.s + } + } + Item { + Layout.fillWidth: true + } } } - Item { - Layout.fillWidth: true + } + Loader { + id: alt + anchors.fill: parent + active: root.isAlt + sourceComponent: Component { + RowLayout { + Item { + Layout.fillWidth: true + } + anchors.fill: parent + spacing: Bar.resourceIconTextSpacing + + Icon { + text: Icons.resource.calendar + font.pixelSize: Style.font.size.larger + } + IText { + animate: true + text: Services.TimeDate.date + } + Item { + Layout.fillWidth: true + } + } } } } + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onPressed: { + root.isAlt = !root.isAlt; + } + } } |
