internal: fix binding loops

This commit is contained in:
2 * r + 2 * t 2025-05-24 13:31:36 +08:00
parent 41004e5d0c
commit 01b38be6af
7 changed files with 31 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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)
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -7,8 +7,6 @@ Rectangle {
property bool vertical: parent?.vertical ?? false // Convenience property for propagation to children
color: "transparent"
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
Behavior on color {
ColorAnimation {