Warning, /plasma/qqc2-breeze-style/style/impl/CursorDelegate.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>
0002  * SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
0003  * SPDX-License-Identifier: LGPL-2.0-or-later
0004  */
0005 
0006 import QtQuick
0007 import QtQuick.Window
0008 import QtQuick.Templates
0009 import org.kde.kirigami as Kirigami
0010 
0011 import "." as Impl
0012 
0013 Item {
0014     id: root
0015     property alias target: root.parent
0016 
0017     Rectangle {
0018         id: cursorLine
0019         property real previousX: 0
0020         property real previousY: 0
0021         parent: target
0022         implicitWidth: target.cursorRectangle.width
0023         implicitHeight: target.cursorRectangle.height
0024         x: Math.floor(target.cursorRectangle.x)
0025         y: Math.floor(target.cursorRectangle.y)
0026 
0027         color: target.color
0028         SequentialAnimation {
0029             id: blinkAnimation
0030             running: root.visible && Qt.styleHints.cursorFlashTime != 0 && target.selectionStart === target.selectionEnd
0031             PropertyAction {
0032                 target: cursorLine
0033                 property: "opacity"
0034                 value: 1
0035             }
0036             PauseAnimation {
0037                 duration: Qt.styleHints.cursorFlashTime/2
0038             }
0039             SequentialAnimation {
0040                 loops: Animation.Infinite
0041                 OpacityAnimator {
0042                     target: cursorLine
0043                     from: 1
0044                     to: 0
0045                     duration: Qt.styleHints.cursorFlashTime/2
0046                     easing.type: Easing.OutCubic
0047                 }
0048                 OpacityAnimator {
0049                     target: cursorLine
0050                     from: 0
0051                     to: 1
0052                     duration: Qt.styleHints.cursorFlashTime/2
0053                     easing.type: Easing.OutCubic
0054                 }
0055             }
0056         }
0057         // NumberAnimations/SmoothedAnimations appear smoother than X/Y Animators for some reason
0058         /*Behavior on x {
0059             SmoothedAnimation {
0060                 velocity: 200
0061                 reversingMode: SmoothedAnimation.Immediate
0062                 duration: Kirigami.Settings.tabletMode ? Kirigami.Units.shortDuration : 0//Kirigami.Units.veryShortDuration
0063             }
0064         }
0065         Behavior on y {
0066             SmoothedAnimation {
0067                 velocity: 200
0068                 reversingMode: SmoothedAnimation.Immediate
0069                 duration: Kirigami.Settings.tabletMode ? Kirigami.Units.shortDuration : 0//Kirigami.Units.veryShortDuration
0070             }
0071         }
0072         */
0073     }
0074 
0075     Connections {
0076         target: root.target
0077         function onCursorPositionChanged() {
0078             blinkAnimation.restart()
0079         }
0080     }
0081 }
0082 
0083