From 3055f53b97598b16def8efae1b22d2337bdd4b30 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 27 Jul 2025 12:51:58 +1000 Subject: dcontent: add adapter name editing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Does not work for now as QS does not provide a way to edit adapter names (will be added soon™) --- widgets/StyledTextField.qml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'widgets') diff --git a/widgets/StyledTextField.qml b/widgets/StyledTextField.qml index ecde872..d4a470a 100644 --- a/widgets/StyledTextField.qml +++ b/widgets/StyledTextField.qml @@ -12,6 +12,8 @@ TextField { placeholderTextColor: Colours.palette.m3outline font.family: Appearance.font.family.sans font.pointSize: Appearance.font.size.smaller + renderType: TextField.NativeRendering + cursorVisible: !readOnly background: null @@ -23,10 +25,17 @@ TextField { implicitWidth: 2 color: Colours.palette.m3primary radius: Appearance.rounding.normal - onXChanged: { - opacity = 1; - disableBlink = true; - enableBlink.start(); + + Connections { + target: root + + function onCursorPositionChanged(): void { + if (root.activeFocus && root.cursorVisible) { + cursor.opacity = 1; + cursor.disableBlink = true; + enableBlink.restart(); + } + } } Timer { @@ -37,12 +46,18 @@ TextField { } Timer { - running: root.cursorVisible && !cursor.disableBlink + running: root.activeFocus && root.cursorVisible && !cursor.disableBlink repeat: true + triggeredOnStart: true interval: 500 onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1 } + Binding { + when: !root.activeFocus || !root.cursorVisible + cursor.opacity: 0 + } + Behavior on opacity { NumberAnimation { duration: Appearance.anim.durations.small -- cgit v1.2.3-freya