diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-13 22:40:13 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-13 22:40:13 +0800 |
| commit | 6487f0a1778efc94f192326c1048f3d05d1b408f (patch) | |
| tree | 17b1a14bb03865fa9437300e458f93b37ab7cbc9 /components | |
| parent | f0b03a1611181b8ff20fc8698bcdb8fa267d23c9 (diff) | |
finish styled top bar
Diffstat (limited to 'components')
| -rw-r--r-- | components/IText.qml | 54 | ||||
| -rw-r--r-- | components/Icons.qml | 5 | ||||
| -rw-r--r-- | components/SimpleResource.qml | 2 |
3 files changed, 51 insertions, 10 deletions
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 } |
