Warning, /plasma/latte-dock/declarativeimports/components/private/MobileCursor.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.1 0008 import org.kde.plasma.core 2.0 as PlasmaCore 0009 import org.kde.kirigami 2.5 as Kirigami 0010 0011 Item { 0012 id: root 0013 width: 1 //<-important that this is actually a single device pixel 0014 height: units.gridUnit 0015 0016 property Item target 0017 0018 property bool selectionStartHandle: false 0019 0020 visible: Kirigami.Settings.tabletMode && ((target.activeFocus && !selectionStartHandle) || target.selectedText.length > 0) 0021 0022 Rectangle { 0023 width: Math.round(units.devicePixelRatio * 3) 0024 anchors { 0025 horizontalCenter: parent.horizontalCenter 0026 top: parent.top 0027 bottom: parent.bottom 0028 } 0029 color: Qt.tint(theme.highlightColor, Qt.rgba(1,1,1,0.4)) 0030 radius: width 0031 Rectangle { 0032 width: Math.round(units.gridUnit/1.5) 0033 height: width 0034 anchors { 0035 horizontalCenter: parent.horizontalCenter 0036 verticalCenter: parent.bottom 0037 } 0038 radius: width 0039 color: Qt.tint(theme.highlightColor, Qt.rgba(1,1,1,0.4)) 0040 } 0041 MouseArea { 0042 anchors { 0043 fill: parent 0044 margins: -units.gridUnit 0045 } 0046 preventStealing: true 0047 onPositionChanged: { 0048 var pos = mapToItem(target, mouse.x, mouse.y); 0049 pos = target.positionAt(pos.x, pos.y); 0050 0051 if (target.selectedText.length > 0) { 0052 if (selectionStartHandle) { 0053 target.select(Math.min(pos, target.selectionEnd - 1), target.selectionEnd); 0054 } else { 0055 target.select(target.selectionStart, Math.max(pos, target.selectionStart + 1)); 0056 } 0057 } else { 0058 target.cursorPosition = pos; 0059 } 0060 } 0061 } 0062 } 0063 }