refactor: use implicit size instead of actual size

This commit is contained in:
2 * r + 2 * t 2025-05-17 20:27:30 +08:00
parent 6e6db08726
commit 6e82fbc8b9
4 changed files with 10 additions and 10 deletions

View file

@ -15,8 +15,8 @@ MouseArea {
required property color colour required property color colour
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
width: Appearance.font.size.smaller * 2 implicitWidth: Appearance.font.size.smaller * 2
height: Appearance.font.size.smaller * 2 implicitHeight: Appearance.font.size.smaller * 2
onClicked: event => { onClicked: event => {
if (event.button === Qt.LeftButton) if (event.button === Qt.LeftButton)

View file

@ -24,8 +24,8 @@ Rectangle {
clip: true clip: true
x: vertical ? 1 : offset + 1 x: vertical ? 1 : offset + 1
y: vertical ? offset + 1 : 1 y: vertical ? offset + 1 : 1
width: (vertical ? BarConfig.sizes.innerHeight : size) - 2 implicitWidth: (vertical ? BarConfig.sizes.innerHeight : size) - 2
height: (vertical ? size : BarConfig.sizes.innerHeight) - 2 implicitHeight: (vertical ? size : BarConfig.sizes.innerHeight) - 2
radius: BarConfig.workspaces.rounded ? Appearance.rounding.full : 0 radius: BarConfig.workspaces.rounded ? Appearance.rounding.full : 0
Rectangle { Rectangle {
@ -53,8 +53,8 @@ Rectangle {
x: root.vertical ? 0 : -parent.offset x: root.vertical ? 0 : -parent.offset
y: root.vertical ? -parent.offset : 0 y: root.vertical ? -parent.offset : 0
width: root.maskWidth implicitWidth: root.maskWidth
height: root.maskHeight implicitHeight: root.maskHeight
anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter

View file

@ -57,8 +57,8 @@ Item {
x: start?.x ?? 0 x: start?.x ?? 0
y: start?.y ?? 0 y: start?.y ?? 0
width: root.vertical ? BarConfig.sizes.innerHeight : end?.x + end?.width - start?.x implicitWidth: root.vertical ? BarConfig.sizes.innerHeight : end?.x + end?.width - start?.x
height: root.vertical ? end?.y + end?.height - start?.y : BarConfig.sizes.innerHeight implicitHeight: root.vertical ? end?.y + end?.height - start?.y : BarConfig.sizes.innerHeight
anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter anchors.verticalCenter: root.vertical ? undefined : parent.verticalCenter

View file

@ -104,8 +104,8 @@ StyledRect {
sourceComponent: ClippingRectangle { sourceComponent: ClippingRectangle {
radius: Appearance.rounding.full radius: Appearance.rounding.full
width: NotifsConfig.sizes.image implicitWidth: NotifsConfig.sizes.image
height: NotifsConfig.sizes.image implicitHeight: NotifsConfig.sizes.image
Image { Image {
anchors.fill: parent anchors.fill: parent