tooltips: add delay

This commit is contained in:
end-4
2025-04-27 23:56:33 +02:00
parent 36e3171391
commit c596cd21f6
@@ -7,9 +7,31 @@ import QtQuick.Layouts
ToolTip {
property string content
property bool extraVisibleCondition: true
property bool internalVisibleCondition: false
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 {
color: Appearance.colors.colTooltip