fix: font assignment in multiple components

This commit is contained in:
2026-11-07 13:39:51 +01:00
parent 1f8f1ee556
commit 4ac55b0c2e
11 changed files with 115 additions and 42 deletions
+2 -2
View File
@@ -118,7 +118,7 @@ Item {
animate: root.animate animate: root.animate
animateProp: "opacity" animateProp: "opacity"
color: root.color color: root.color
font.pointSize: elideText.font.pointSize font: elideText.font
text: elideText.text text: elideText.text
} }
@@ -128,7 +128,7 @@ Item {
animate: root.animate animate: root.animate
animateProp: "opacity" animateProp: "opacity"
color: root.color color: root.color
font.pointSize: elideText.font.pointSize font: elideText.font
text: t1.text text: t1.text
x: t1.width + root.gap x: t1.width + root.gap
} }
+1 -1
View File
@@ -227,7 +227,7 @@ SnapLayout {
anchors.right: parent.right anchors.right: parent.right
animateProp: "opacity" animateProp: "opacity"
color: Colors.palette.m3onSurfaceVariant color: Colors.palette.m3onSurfaceVariant
font.family: Config.appearance.font.family.mono font: Tokens.font.mono.medium
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
lineHeight: 1.2 lineHeight: 1.2
opacity: shouldBeVisible && !message.msg ? 1 : 0 opacity: shouldBeVisible && !message.msg ? 1 : 0
+86
View File
@@ -0,0 +1,86 @@
import QtQuick
import QtQuick.Templates
import ZShell.Config
import qs.Services
TextField {
id: root
color: Colors.palette.m3onSurface
cursorVisible: !readOnly
font: Tokens.font.body.small
implicitHeight: contentHeight + topPadding + bottomPadding
implicitWidth: contentWidth + leftPadding + rightPadding
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
renderType: TextField.QtRendering
selectedTextColor: color
selectionColor: Qt.alpha(Colors.palette.m3primary, 0.4)
verticalAlignment: TextInput.AlignVCenter
Behavior on color {
CAnim {}
}
cursorDelegate: Item {}
Behavior on selectionColor {
CAnim {}
}
CustomRect {
id: cursor
property bool disableBlink
color: Colors.palette.m3primary
implicitHeight: root.cursorRectangle.height
implicitWidth: 1.5
radius: Tokens.rounding.largeIncreased
x: root.cursorRectangle.x
y: root.cursorRectangle.y
Behavior on opacity {
Anim {
type: Anim.StandardSmall
}
}
Behavior on x {
Anim {
duration: Tokens.anim.durations.expressiveFastEffects
easing.bezierCurve: [0.2, 1, 0.21, 1, 1, 1]
}
}
Connections {
function onCursorPositionChanged(): void {
if (root.activeFocus && root.cursorVisible) {
cursor.opacity = 1;
cursor.disableBlink = true;
enableBlink.restart();
}
}
target: root
}
Timer {
id: enableBlink
interval: 500
onTriggered: cursor.disableBlink = false
}
Timer {
interval: 500
repeat: true
running: root.activeFocus && root.cursorVisible && !cursor.disableBlink
triggeredOnStart: true
onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1
}
Binding {
cursor.opacity: 0
when: !root.activeFocus || !root.cursorVisible
}
}
}
+3 -4
View File
@@ -40,7 +40,7 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
animate: true animate: true
color: root.greeter.launching ? Colors.palette.m3secondary : Colors.palette.m3outline color: root.greeter.launching ? Colors.palette.m3secondary : Colors.palette.m3outline
font: Tokens.font.mono.medium font: Tokens.font.body.builders.medium.width(110).build()
opacity: root.buffer ? 0 : 1 opacity: root.buffer ? 0 : 1
text: { text: {
if (root.greeter.launching) if (root.greeter.launching)
@@ -86,10 +86,9 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0 anchors.horizontalCenterOffset: implicitWidth > root.width ? -(implicitWidth - root.width) / 2 : 0
implicitHeight: Tokens.font.body.medium implicitHeight: Tokens.font.body.medium.pointSize
implicitWidth: fullWidth implicitWidth: fullWidth
interactive: false interactive: false
opacity: root.greeter.echoResponse ? 0 : 1
orientation: Qt.Horizontal orientation: Qt.Horizontal
spacing: Tokens.spacing.small / 2 spacing: Tokens.spacing.small / 2
@@ -100,7 +99,7 @@ Item {
implicitHeight: charList.implicitHeight implicitHeight: charList.implicitHeight
implicitWidth: implicitHeight implicitWidth: implicitHeight
opacity: 0 opacity: 0
radius: Tokens.rounding.small / 2 radius: Tokens.rounding.full
scale: 0 scale: 0
Behavior on opacity { Behavior on opacity {
+2 -2
View File
@@ -14,7 +14,7 @@ import qs.Services
WidgetBase { WidgetBase {
id: root id: root
readonly property font font: Tokens.font.clock.family(Config.appearance.font.family.clock).build() readonly property font font: Tokens.font.clock.family(Config.appearance.font.family.clock).size(Tokens.font.body.small.pointSize).build()
readonly property color contentColor: Colors.palette.m3onSurface readonly property color contentColor: Colors.palette.m3onSurface
readonly property string effectiveFormat: { readonly property string effectiveFormat: {
let fmt = Config.general.dateFormat; let fmt = Config.general.dateFormat;
@@ -71,8 +71,8 @@ WidgetBase {
} }
SnapLayout { SnapLayout {
orientation: Qt.Vertical
id: verticalColumn id: verticalColumn
orientation: Qt.Vertical
anchors.centerIn: parent anchors.centerIn: parent
spacing: Tokens.padding.extraSmall ?? 2 spacing: Tokens.padding.extraSmall ?? 2
+1 -2
View File
@@ -73,8 +73,7 @@ Item {
anchors.topMargin: root.horizontal ? 0 : Tokens.spacing.small anchors.topMargin: root.horizontal ? 0 : Tokens.spacing.small
anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined anchors.verticalCenter: root.horizontal ? parent.verticalCenter : undefined
color: root.color color: root.color
font.family: metrics.font.family font: metrics.font
font.pointSize: metrics.font.pointSize
height: root.horizontal ? implicitHeight : implicitWidth height: root.horizontal ? implicitHeight : implicitWidth
opacity: root.current === this ? 1 : 0 opacity: root.current === this ? 1 : 0
width: root.horizontal ? implicitWidth : implicitHeight width: root.horizontal ? implicitWidth : implicitHeight
+5 -3
View File
@@ -19,6 +19,8 @@ Item {
readonly property int panelRadius: Tokens.rounding.largeIncreased + Tokens.padding.smaller readonly property int panelRadius: Tokens.rounding.largeIncreased + Tokens.padding.smaller
readonly property int rounding: panelRadius - Tokens.padding.smaller readonly property int rounding: panelRadius - Tokens.padding.smaller
readonly property int topMargin: 0 readonly property int topMargin: 0
readonly property font valueFont: Tokens.font.body.builders.small.weight(Font.DemiBold).build()
required property var wrapper required property var wrapper
implicitHeight: vol.implicitHeight + Tokens.padding.smaller * 2 implicitHeight: vol.implicitHeight + Tokens.padding.smaller * 2
@@ -79,7 +81,7 @@ orientation: Qt.Vertical
CustomText { CustomText {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
color: Qt.alpha(Colors.palette.m3onSurface, 0.7) color: Qt.alpha(Colors.palette.m3onSurface, 0.7)
font.bold: true font: root.valueFont
text: qsTr("%1").arg(Audio.muted ? qsTr("Muted") : `${Math.round(Audio.volume * 100)}%`) text: qsTr("%1").arg(Audio.muted ? qsTr("Muted") : `${Math.round(Audio.volume * 100)}%`)
} }
} }
@@ -177,7 +179,7 @@ orientation: Qt.Vertical
CustomText { CustomText {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
color: Qt.alpha(Colors.palette.m3onSurface, 0.7) color: Qt.alpha(Colors.palette.m3onSurface, 0.7)
font.bold: true font: root.valueFont
text: qsTr("%1").arg(Audio.sourceMuted ? qsTr("Muted") : `${Math.round(Audio.sourceVolume * 100)}%`) text: qsTr("%1").arg(Audio.sourceMuted ? qsTr("Muted") : `${Math.round(Audio.sourceVolume * 100)}%`)
} }
} }
@@ -302,7 +304,7 @@ orientation: Qt.Vertical
CustomText { CustomText {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
color: Qt.alpha(Colors.palette.m3onSurface, 0.7) color: Qt.alpha(Colors.palette.m3onSurface, 0.7)
font.bold: true font: root.valueFont
text: qsTr("%1").arg(appBox.modelData.audio.muted ? qsTr("Muted") : `${Math.round(appBox.modelData.audio.volume * 100)}%`) text: qsTr("%1").arg(appBox.modelData.audio.muted ? qsTr("Muted") : `${Math.round(appBox.modelData.audio.volume * 100)}%`)
} }
} }
+2 -1
View File
@@ -112,7 +112,7 @@ Column {
CustomText { CustomText {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: Colors.palette.m3onError color: Colors.palette.m3onError
font.family: Config.appearance.font.family.mono font: Tokens.font.mono.small
text: qsTr("Performance Degraded") text: qsTr("Performance Degraded")
} }
@@ -127,6 +127,7 @@ Column {
CustomText { CustomText {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
color: Colors.palette.m3onError color: Colors.palette.m3onError
font: Tokens.font.label.small
text: qsTr("Reason: %1").arg(PerformanceDegradationReason.toString(PowerProfiles.degradationReason)) text: qsTr("Reason: %1").arg(PerformanceDegradationReason.toString(PowerProfiles.degradationReason))
} }
} }
+1 -1
View File
@@ -4,10 +4,10 @@ import Quickshell
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import ZShell.Components import ZShell.Components
import ZShell.Config
import qs.Modules import qs.Modules
import qs.Components import qs.Components
import qs.Helpers import qs.Helpers
import ZShell.Config
import qs.Services import qs.Services
Item { Item {
+5 -17
View File
@@ -7,8 +7,8 @@ import qs.Helpers
import qs.Services import qs.Services
SnapLayout { SnapLayout {
orientation: Qt.Vertical
id: root id: root
orientation: Qt.Vertical
required property int start required property int start
required property int end required property int end
@@ -67,10 +67,7 @@ orientation: Qt.Vertical
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
clip: true clip: true
color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface
font.family: "Roboto" font: Tokens.font.body.builders.large.family("Roboto").letterSpacing(-0.25).pixelSize(56).weight(400).build()
font.letterSpacing: -0.25
font.pixelSize: 56
font.weight: 400
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
text: setConfigText() text: setConfigText()
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
@@ -179,10 +176,7 @@ orientation: Qt.Vertical
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
clip: true clip: true
color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface
font.family: "Roboto" font: Tokens.font.body.builders.large.family("Roboto").letterSpacing(-0.25).pixelSize(56).weight(400).build()
font.letterSpacing: -0.25
font.pixelSize: 56
font.weight: 400
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
text: setConfigText() text: setConfigText()
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
@@ -290,10 +284,7 @@ orientation: Qt.Vertical
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
clip: true clip: true
color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface
font.family: "Roboto" font: Tokens.font.body.builders.large.family("Roboto").letterSpacing(-0.25).pixelSize(56).weight(400).build()
font.letterSpacing: -0.25
font.pixelSize: 56
font.weight: 400
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
text: setConfigText() text: setConfigText()
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
@@ -402,10 +393,7 @@ orientation: Qt.Vertical
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
clip: true clip: true
color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface color: focus ? Colors.palette.m3primaryContainer : Colors.palette.m3onSurface
font.family: "Roboto" font: Tokens.font.body.builders.large.family("Roboto").letterSpacing(-0.25).pixelSize(56).weight(400).build()
font.letterSpacing: -0.25
font.pixelSize: 56
font.weight: 400
horizontalAlignment: TextInput.AlignHCenter horizontalAlignment: TextInput.AlignHCenter
text: setConfigText() text: setConfigText()
verticalAlignment: TextInput.AlignVCenter verticalAlignment: TextInput.AlignVCenter
+3 -5
View File
@@ -36,9 +36,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
color: Colors.palette.m3outline color: Colors.palette.m3outline
font.family: "CaskaydiaCove NF" font: Tokens.font.mono.builders.small.weight(Font.DemiBold).build()
font.pointSize: 13
font.weight: 500
text: qsTr("%1 Chat%2").arg(list.count).arg(list.count > 1 ? "s" : "") text: qsTr("%1 Chat%2").arg(list.count).arg(list.count > 1 ? "s" : "")
} }
@@ -134,7 +132,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.margins: Tokens.padding.small anchors.margins: Tokens.padding.small
padding: 8 padding: 8
font.pointSize: Math.round(18 * 1.2) font: Tokens.font.icon.builders.medium.size(Math.round(18 * 1.2)).build()
icon: root.slim ? "left_panel_open" : "add" icon: root.slim ? "left_panel_open" : "add"
isRound: ChatState.fabExpanded isRound: ChatState.fabExpanded
@@ -298,7 +296,7 @@ Item {
CustomText { CustomText {
animate: true animate: true
text: fabMenuItem.modelData.name text: fabMenuItem.modelData.name
font.capitalization: Font.Capitalize font: Tokens.font.body.builders.small.capitalization(Font.Capitalize).build
color: Colors.palette.m3onPrimaryContainer color: Colors.palette.m3onPrimaryContainer
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth