summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/ITextEdit.qml50
-rw-r--r--popups/launcher/components/Clip.qml3
-rw-r--r--shell.qml1
3 files changed, 53 insertions, 1 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();
+ }
+ }
+}
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