summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/StyledTextField.qml38
1 files changed, 37 insertions, 1 deletions
diff --git a/widgets/StyledTextField.qml b/widgets/StyledTextField.qml
index f6232f2..cb1ce83 100644
--- a/widgets/StyledTextField.qml
+++ b/widgets/StyledTextField.qml
@@ -7,12 +7,48 @@ import QtQuick.Controls
TextField {
id: root
- renderType: TextField.NativeRendering
color: Appearance.colours.m3onSurface
placeholderTextColor: Appearance.colours.m3outline
font.family: Appearance.font.family.sans
font.pointSize: Appearance.font.size.smaller
+ cursorDelegate: StyledRect {
+ id: cursor
+
+ property bool disableBlink
+
+ implicitWidth: 2
+ color: Appearance.colours.m3primary
+ radius: Appearance.rounding.normal
+ onXChanged: {
+ opacity = 1;
+ disableBlink = true;
+ enableBlink.start();
+ }
+
+ Timer {
+ id: enableBlink
+
+ interval: 100
+ onTriggered: cursor.disableBlink = false
+ }
+
+ Timer {
+ running: root.cursorVisible && !cursor.disableBlink
+ repeat: true
+ interval: 500
+ onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1
+ }
+
+ Behavior on opacity {
+ NumberAnimation {
+ duration: Appearance.anim.durations.small
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.standard
+ }
+ }
+ }
+
Behavior on color {
ColorAnimation {
duration: Appearance.anim.durations.normal