Tooltip: Refactoring in a single global tooltip.

This commit is contained in:
ItsLemmy
2025-09-28 00:15:43 -04:00
parent 92460fc5c3
commit 0593543d7a
30 changed files with 532 additions and 382 deletions
+11 -10
View File
@@ -46,6 +46,15 @@ Item {
width: pillHeight + Math.max(0, pill.width - pillOverlap)
height: pillHeight
Connections {
target: root
function onTooltipTextChanged() {
if (PanelService.tooltip.visible) {
PanelService.tooltip.updateText(root.tooltipText)
}
}
}
Rectangle {
id: pill
width: revealed ? pillMaxWidth : 1
@@ -195,14 +204,6 @@ Item {
}
}
NTooltip {
id: tooltip
positionAbove: Settings.data.bar.position === "bottom"
target: pill
delay: Style.tooltipDelayLong
text: root.tooltipText
}
Timer {
id: showTimer
interval: Style.pillDelay
@@ -220,7 +221,7 @@ Item {
onEntered: {
hovered = true
root.entered()
tooltip.show()
PanelService.tooltip.show(pill, root.tooltipText, BarService.getTooltipDirection(), Style.tooltipDelayLong)
if (disableOpen || forceClose) {
return
}
@@ -234,7 +235,7 @@ Item {
if (!forceOpen && !forceClose) {
hide()
}
tooltip.hide()
PanelService.tooltip.hide()
}
onClicked: function (mouse) {
if (mouse.button === Qt.LeftButton) {
+11 -11
View File
@@ -58,6 +58,15 @@ Item {
width: buttonSize
height: revealed ? (buttonSize + maxPillHeight - pillOverlap) : buttonSize
Connections {
target: root
function onTooltipTextChanged() {
if (PanelService.tooltip.visible) {
PanelService.tooltip.updateText(root.tooltipText)
}
}
}
Rectangle {
id: pill
width: revealed ? maxPillWidth : 1
@@ -236,15 +245,6 @@ Item {
}
}
NTooltip {
id: tooltip
target: pill
text: root.tooltipText
positionLeft: barPosition === "right"
positionRight: barPosition === "left"
delay: Style.tooltipDelayLong
}
Timer {
id: showTimer
interval: Style.pillDelay
@@ -262,7 +262,7 @@ Item {
onEntered: {
hovered = true
root.entered()
tooltip.show()
PanelService.tooltip.show(pill, root.tooltipText, BarService.getTooltipDirection(), Style.tooltipDelayLong)
if (disableOpen || forceClose) {
return
}
@@ -276,7 +276,7 @@ Item {
if (!forceOpen && !forceClose) {
hide()
}
tooltip.hide()
PanelService.tooltip.hide()
}
onClicked: function (mouse) {
if (mouse.button === Qt.LeftButton) {