diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-08-05 20:52:22 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-08-05 20:52:22 +0800 |
| commit | f20f6351c9929c27461e80ff21a48105e26e6cc2 (patch) | |
| tree | 7b4c7e41e9813aa0a7fcc1bc966f6c6aa405de85 /components | |
| parent | 54d54f503aab6f291e83635e8f54a96f55f1df30 (diff) | |
new: ITextEdit
Diffstat (limited to 'components')
| -rw-r--r-- | components/ITextEdit.qml | 50 |
1 files changed, 50 insertions, 0 deletions
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(); + } + } +} |
