diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-27 12:51:58 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-27 12:51:58 +1000 |
| commit | 3055f53b97598b16def8efae1b22d2337bdd4b30 (patch) | |
| tree | 60d9faba503b25de58726b84c72ec8b104909c03 /widgets/StyledTextField.qml | |
| parent | dcontent: fix discoverable timeout spinbox (diff) | |
| download | caelestia-shell-3055f53b97598b16def8efae1b22d2337bdd4b30.tar.gz caelestia-shell-3055f53b97598b16def8efae1b22d2337bdd4b30.tar.bz2 caelestia-shell-3055f53b97598b16def8efae1b22d2337bdd4b30.zip | |
dcontent: add adapter name editing
Does not work for now as QS does not provide a way to edit adapter names (will be added soon™)
Diffstat (limited to 'widgets/StyledTextField.qml')
| -rw-r--r-- | widgets/StyledTextField.qml | 25 |
1 files changed, 20 insertions, 5 deletions
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 |