Warning, /plasma/plasma-desktop/applets/taskmanager/package/contents/ui/ScrollableTextWrapper.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 Tranter Madi <trmdi@yandex.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 
0009 MouseArea {
0010     id: textWrapper
0011 
0012     default property Text textItem
0013 
0014     clip: textItem.elide === Text.ElideNone
0015     hoverEnabled: true
0016 
0017     onContainsMouseChanged: {
0018         if (!containsMouse) {
0019             state = ""
0020         }
0021     }
0022 
0023     Timer {
0024         id: timer
0025         interval: 500
0026         running: textWrapper.containsMouse
0027         onTriggered: {
0028             if (textWrapper.width < textItem.implicitWidth) {
0029                 textWrapper.state = "ShowRight"
0030             }
0031         }
0032     }
0033 
0034     states: [
0035         State {
0036             name: ""
0037             PropertyChanges { target: textItem; x: 0 }
0038         },
0039         State {
0040             name: "ShowRight"
0041             PropertyChanges { target: textItem; x: textWrapper.width - textItem.implicitWidth }
0042         }
0043     ]
0044 
0045     transitions: Transition {
0046         to: "ShowRight"
0047         NumberAnimation {
0048             target: textItem; properties: "x";
0049             easing.type: Easing.Linear;
0050             duration: Math.abs(textItem.implicitWidth - textWrapper.width)*25
0051         }
0052     }
0053 }