forked from Shinonome/dots-hyprland
tooltips: add delay
This commit is contained in:
@@ -7,9 +7,31 @@ import QtQuick.Layouts
|
|||||||
ToolTip {
|
ToolTip {
|
||||||
property string content
|
property string content
|
||||||
property bool extraVisibleCondition: true
|
property bool extraVisibleCondition: true
|
||||||
|
property bool internalVisibleCondition: false
|
||||||
padding: 7
|
padding: 7
|
||||||
|
|
||||||
visible: (extraVisibleCondition && (parent.hovered === undefined || parent?.hovered))
|
visible: (extraVisibleCondition && (parent.hovered === undefined || parent?.hovered) && internalVisibleCondition)
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: parent
|
||||||
|
onHoveredChanged: {
|
||||||
|
if (parent.hovered) {
|
||||||
|
tooltipShowDelay.restart()
|
||||||
|
} else {
|
||||||
|
internalVisibleCondition = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: tooltipShowDelay
|
||||||
|
interval: 200
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
onTriggered: {
|
||||||
|
internalVisibleCondition = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Appearance.colors.colTooltip
|
color: Appearance.colors.colTooltip
|
||||||
|
|||||||
Reference in New Issue
Block a user