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 +++++++++++++++++++++++++++++++++++++ popups/launcher/components/Clip.qml | 3 ++- shell.qml | 1 + 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 components/ITextEdit.qml 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(); + } + } +} diff --git a/popups/launcher/components/Clip.qml b/popups/launcher/components/Clip.qml index a8f1863..a180b80 100644 --- a/popups/launcher/components/Clip.qml +++ b/popups/launcher/components/Clip.qml @@ -187,7 +187,8 @@ IComponent { Loader { id: loader sourceComponent: clipHist[selectedIndex]?.type === "image" ? img : text - property Component text: TextEdit { + property Component text: ITextEdit { + animate: true id: textEdit readOnly: true wrapMode: TextEdit.Wrap diff --git a/shell.qml b/shell.qml index 0539ea7..bed6eb4 100644 --- a/shell.qml +++ b/shell.qml @@ -22,6 +22,7 @@ Scope { property bool active: false } + // TODO: cache/don't destory when closed(active=false) LazyLoader { id: launcherLoader -- cgit v1.2.3