From 01b38be6afbe660e3b9f9e136870a76afb69bf31 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 24 May 2025 13:31:36 +0800 Subject: internal: fix binding loops --- modules/bar/components/ActiveWindow.qml | 6 +++++- modules/bar/components/Clock.qml | 8 +++++++- modules/bar/components/StatusIcons.qml | 9 ++++++++- modules/bar/components/Tray.qml | 8 +++++++- modules/launcher/Content.qml | 3 +++ modules/notifications/Notification.qml | 2 +- 6 files changed, 31 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/bar/components/ActiveWindow.qml b/modules/bar/components/ActiveWindow.qml index 75dfc43..b2b9572 100644 --- a/modules/bar/components/ActiveWindow.qml +++ b/modules/bar/components/ActiveWindow.qml @@ -15,12 +15,16 @@ Item { implicitWidth: child.implicitWidth implicitHeight: child.implicitHeight - StyledRect { + Item { id: child + readonly property bool vertical: root.vertical + anchors.centerIn: parent clip: true + implicitWidth: root.vertical ? Math.max(icon.implicitWidth, text.implicitHeight) : icon.implicitWidth + text.implicitWidth + text.anchors.leftMargin + implicitHeight: root.vertical ? icon.implicitHeight + text.implicitWidth + text.anchors.topMargin : Math.max(icon.implicitHeight, text.implicitheight) MaterialIcon { id: icon diff --git a/modules/bar/components/Clock.qml b/modules/bar/components/Clock.qml index 3397222..bec7e30 100644 --- a/modules/bar/components/Clock.qml +++ b/modules/bar/components/Clock.qml @@ -3,11 +3,15 @@ import "root:/services" import "root:/config" import QtQuick -StyledRect { +Item { id: root + readonly property bool vertical: parent?.vertical ?? false property color colour: Colours.palette.peach + implicitWidth: vertical ? Math.max(icon.implicitWidth, text.implicitWidth) : icon.implicitWidth + text.implicitWidth + text.anchors.leftMargin + implicitHeight: vertical ? icon.implicitHeight + text.implicitHeight + text.anchors.topMargin : Math.max(icon.implicitHeight, text.implicitHeight) + MaterialIcon { id: icon @@ -18,6 +22,8 @@ StyledRect { } AnchorText { + id: text + prevAnchor: icon horizontalAlignment: StyledText.AlignHCenter diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml index 62823e0..14c02f9 100644 --- a/modules/bar/components/StatusIcons.qml +++ b/modules/bar/components/StatusIcons.qml @@ -5,12 +5,15 @@ import "root:/config" import Quickshell import QtQuick -StyledRect { +Item { id: root + readonly property bool vertical: parent?.vertical ?? false property color colour: Colours.palette.rosewater clip: true + implicitWidth: vertical ? Math.max(network.implicitWidth, bluetooth.implicitWidth, devices.implicitWidth) : network.implicitWidth + bluetooth.implicitWidth + bluetooth.anchors.leftMargin + (repeater.count > 0 ? devices.implicitWidth + devices.anchors.leftMargin : 0) + implicitHeight: vertical ? network.implicitHeight + bluetooth.implicitHeight + bluetooth.anchors.topMargin + (repeater.count > 0 ? devices.implicitHeight + devices.anchors.topMargin : 0) : Math.max(network.implicitHeight, bluetooth.implicitHeight, devices.implicitHeight) MaterialIcon { id: network @@ -35,6 +38,8 @@ StyledRect { } Box { + id: devices + anchors.left: vertical ? undefined : bluetooth.right anchors.leftMargin: vertical ? 0 : Appearance.padding.smaller anchors.top: vertical ? bluetooth.bottom : undefined @@ -44,6 +49,8 @@ StyledRect { anchors.verticalCenter: vertical ? undefined : bluetooth.verticalCenter Repeater { + id: repeater + model: ScriptModel { values: Bluetooth.devices.filter(d => d.connected) } diff --git a/modules/bar/components/Tray.qml b/modules/bar/components/Tray.qml index ccebe1f..8ccd48a 100644 --- a/modules/bar/components/Tray.qml +++ b/modules/bar/components/Tray.qml @@ -4,15 +4,21 @@ import "root:/config" import Quickshell.Services.SystemTray import QtQuick -StyledRect { +Item { id: root + readonly property bool vertical: parent?.vertical ?? false property color colour: Colours.palette.lavender clip: true visible: width > 0 && height > 0 // To avoid warnings about being visible with no size + implicitWidth: layout.implicitWidth + implicitHeight: layout.implicitHeight + BoxLayout { + id: layout + Repeater { model: SystemTray.items diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index be3667d..54cc872 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -50,6 +50,8 @@ Item { anchors.bottom: parent.bottom anchors.margins: root.padding + implicitHeight: Math.max(searchIcon.implicitHeight, search.implicitHeight, clearIcon.implicitHeight) + MaterialIcon { id: searchIcon @@ -139,6 +141,7 @@ Item { anchors.fill: parent hoverEnabled: true + cursorShape: search.text ? Qt.PointingHandCursor : undefined onEntered: hovered = true onExited: hovered = false diff --git a/modules/notifications/Notification.qml b/modules/notifications/Notification.qml index cc446c9..d8c8ba7 100644 --- a/modules/notifications/Notification.qml +++ b/modules/notifications/Notification.qml @@ -21,7 +21,7 @@ StyledRect { color: root.modelData?.urgency === NotificationUrgency.Critical ? Colours.palette.m3secondaryContainer : Colours.palette.m3surfaceContainer radius: Appearance.rounding.normal implicitWidth: NotifsConfig.sizes.width - implicitHeight: inner.height + implicitHeight: inner.implicitHeight x: NotifsConfig.sizes.width Component.onCompleted: x = 0 -- cgit v1.2.3-freya