mirror of
https://gitgud.io/wackyideas/aerothemeplasma.git
synced 2024-08-15 00:43:43 +00:00
54 lines
1.1 KiB
QML
54 lines
1.1 KiB
QML
|
/*
|
||
|
SPDX-FileCopyrightText: 2020 Tranter Madi <trmdi@yandex.com>
|
||
|
|
||
|
SPDX-License-Identifier: LGPL-2.0-or-later
|
||
|
*/
|
||
|
|
||
|
import QtQuick 2.6
|
||
|
|
||
|
MouseArea {
|
||
|
id: textWrapper
|
||
|
|
||
|
default property Text textItem
|
||
|
|
||
|
clip: textItem.elide === Text.ElideNone
|
||
|
hoverEnabled: true
|
||
|
|
||
|
onContainsMouseChanged: {
|
||
|
if (!containsMouse) {
|
||
|
state = ""
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Timer {
|
||
|
id: timer
|
||
|
interval: 500
|
||
|
running: textWrapper.containsMouse
|
||
|
onTriggered: {
|
||
|
if (textWrapper.width < textItem.implicitWidth) {
|
||
|
textWrapper.state = "ShowRight"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
states: [
|
||
|
State {
|
||
|
name: ""
|
||
|
PropertyChanges { target: textItem; x: 0 }
|
||
|
},
|
||
|
State {
|
||
|
name: "ShowRight"
|
||
|
PropertyChanges { target: textItem; x: textWrapper.width - textItem.implicitWidth }
|
||
|
}
|
||
|
]
|
||
|
|
||
|
transitions: Transition {
|
||
|
to: "ShowRight"
|
||
|
NumberAnimation {
|
||
|
target: textItem; properties: "x";
|
||
|
easing.type: Easing.Linear;
|
||
|
duration: Math.abs(textItem.implicitWidth - textWrapper.width)*25
|
||
|
}
|
||
|
}
|
||
|
}
|