C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
90 lines
1.8 KiB
QML
90 lines
1.8 KiB
QML
import QtQuick
|
|
import QtQuick.Templates
|
|
import ZShell.Config
|
|
import qs.Services
|
|
|
|
TextField {
|
|
id: root
|
|
|
|
color: Colors.palette.m3onSurface
|
|
cursorVisible: !readOnly
|
|
font.pointSize: Tokens.font.size.small
|
|
implicitHeight: contentHeight + topPadding + bottomPadding
|
|
implicitWidth: contentWidth + leftPadding + rightPadding
|
|
placeholderTextColor: Colors.palette.m3onSurfaceVariant // No anim cause placeholder is custom
|
|
renderType: echoMode === TextField.Password ? TextField.QtRendering : TextField.NativeRendering
|
|
selectedTextColor: color
|
|
selectionColor: Qt.alpha(Colors.palette.m3primary, 0.4)
|
|
verticalAlignment: TextInput.AlignVCenter
|
|
|
|
Behavior on color {
|
|
CAnim {
|
|
}
|
|
}
|
|
cursorDelegate: Item {
|
|
}
|
|
Behavior on selectionColor {
|
|
CAnim {
|
|
}
|
|
}
|
|
|
|
CustomRect {
|
|
id: cursor
|
|
|
|
property bool disableBlink
|
|
|
|
color: Colors.palette.m3primary
|
|
implicitHeight: root.cursorRectangle.height
|
|
implicitWidth: 1.5
|
|
radius: Tokens.rounding.largeIncreased
|
|
x: root.cursorRectangle.x
|
|
y: root.cursorRectangle.y
|
|
|
|
Behavior on opacity {
|
|
Anim {
|
|
type: Anim.StandardSmall
|
|
}
|
|
}
|
|
Behavior on x {
|
|
Anim {
|
|
duration: Tokens.anim.durations.expressiveFastEffects
|
|
easing.bezierCurve: [0.2, 1, 0.21, 1, 1, 1]
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
function onCursorPositionChanged(): void {
|
|
if (root.activeFocus && root.cursorVisible) {
|
|
cursor.opacity = 1;
|
|
cursor.disableBlink = true;
|
|
enableBlink.restart();
|
|
}
|
|
}
|
|
|
|
target: root
|
|
}
|
|
|
|
Timer {
|
|
id: enableBlink
|
|
|
|
interval: 500
|
|
|
|
onTriggered: cursor.disableBlink = false
|
|
}
|
|
|
|
Timer {
|
|
interval: 500
|
|
repeat: true
|
|
running: root.activeFocus && root.cursorVisible && !cursor.disableBlink
|
|
triggeredOnStart: true
|
|
|
|
onTriggered: parent.opacity = parent.opacity === 1 ? 0 : 1
|
|
}
|
|
|
|
Binding {
|
|
cursor.opacity: 0
|
|
when: !root.activeFocus || !root.cursorVisible
|
|
}
|
|
}
|
|
}
|