From 6487f0a1778efc94f192326c1048f3d05d1b408f Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 13 Jul 2025 22:40:13 +0800 Subject: finish styled top bar --- components/IText.qml | 54 +++++++++++++++++++++++++++++++++++++------ components/Icons.qml | 5 ++-- components/SimpleResource.qml | 2 +- 3 files changed, 51 insertions(+), 10 deletions(-) (limited to 'components') diff --git a/components/IText.qml b/components/IText.qml index 1b971c4..bbd9861 100644 --- a/components/IText.qml +++ b/components/IText.qml @@ -1,15 +1,55 @@ +pragma ComponentBehavior: Bound + import QtQuick -import QtQuick.Layouts import qs.config Text { + id: root + + property bool animate: false + property string animateProp: "scale" + property real animateFrom: 0 + property real animateTo: 1 + property int animateDuration: Style.anim.durations.normal + renderType: Text.NativeRendering - verticalAlignment: Text.AlignVCenter + textFormat: Text.PlainText + color: Colors.foreground + font { - hintingPreference: Font.PreferFullHinting - family: Appearance?.font.family.main ?? "sans-serif" - pixelSize: Appearance?.font.pixelSize.small ?? 15 + family: Style.font.family.iosevka + // pointSize: root.pixelSize + pixelSize: Style.font.size.largerr + } + + Behavior on color { + ColorAnimation { + duration: Style.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Style.anim.curves.standard + } + } + + Behavior on text { + enabled: root.animate + + SequentialAnimation { + Anim { + to: root.animateFrom + easing.bezierCurve: Appearance.anim.curves.standardAccel + } + PropertyAction {} + Anim { + to: root.animateTo + easing.bezierCurve: Appearance.anim.curves.standardDecel + } + } + } + + component Anim: NumberAnimation { + target: root + property: root.animateProp + duration: root.animateDuration / 2 + easing.type: Easing.BezierSpline } - color: Appearance?.m3colors.m3onBackground ?? "black" - linkColor: Appearance?.m3colors.m3primary } diff --git a/components/Icons.qml b/components/Icons.qml index 4b3915c..a5d2348 100644 --- a/components/Icons.qml +++ b/components/Icons.qml @@ -3,14 +3,15 @@ import QtQuick.Layouts import qs.config -Text { +IText { id: root property real iconSize: General.iconSize property real fill: 0 property real truncatedFill: Math.round(fill * 100) / 100 // Reduce memory consumption spikes from constant font remapping renderType: Text.NativeRendering font { - hintingPreference: Font.PreferFullHinting + // hintingPreference: Font.PreferFullHinting + hintingPreference: Font.PreferNoHinting // so the icons dont just offset away family: Style.font.family.symbols ?? "Symbols Nerd Font" pixelSize: iconSize weight: Font.Normal + (Font.DemiBold - Font.Normal) * fill diff --git a/components/SimpleResource.qml b/components/SimpleResource.qml index bd88085..0069f53 100644 --- a/components/SimpleResource.qml +++ b/components/SimpleResource.qml @@ -34,7 +34,7 @@ Item { Icons { text: root.icon } - Text { + IText { text: root.text } -- cgit v1.2.3