From f20f6351c9929c27461e80ff21a48105e26e6cc2 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 5 Aug 2026 20:52:22 +0800 Subject: new: ITextEdit --- components/ITextEdit.qml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 components/ITextEdit.qml (limited to 'components') diff --git a/components/ITextEdit.qml b/components/ITextEdit.qml new file mode 100644 index 0000000..c6f94ad --- /dev/null +++ b/components/ITextEdit.qml @@ -0,0 +1,50 @@ +pragma ComponentBehavior: Bound + +import QtQuick + +import qs.config + +TextEdit { + id: root + + property bool animate: false + property real animateFrom: 0 + property real animateTo: 1 + property real fontSize: Style.font.size.larger + + renderType: Text.NativeRendering // or Text.CurveRendering(much more expansive) or Text.QtRendering for faster + textFormat: Text.PlainText + color: Colors.foreground1 + smooth: true + + font { + family: Style.font.family.iosevka + // pointSize: root.pixelSize + pixelSize: fontSize + } + + Behavior on color { + ColorAnimation { + duration: Style.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Style.anim.curves.standard + } + } + + NumberAnimation { + id: scaleAnim + target: root + property: "scale" + duration: General.animationDuration / 4 + easing.type: Easing.BezierSpline + } + + onTextChanged: { + if (animate) { + root.scale = animateFrom; + scaleAnim.to = animateTo; + scaleAnim.easing.bezierCurve = Style.anim.curves.standardAccel; + scaleAnim.start(); + } + } +} -- cgit v1.2.3