Extract indicators bar widget

This commit is contained in:
David Heinemeier Hansson
2026-05-20 18:32:00 +02:00
parent 1e63e86133
commit cf4729ca2b
16 changed files with 470 additions and 455 deletions
+3 -1
View File
@@ -11,10 +11,11 @@ WidgetButton {
property string activeTooltipText: ""
property string inactiveTooltipText: activeTooltipText
property string indicatorBlock: "single"
property var indicatorHost: null
property var activeOverride: null
readonly property bool effectiveActive: activeOverride === null || activeOverride === undefined ? active : activeOverride === true
readonly property bool belongsInBlock: indicatorBlock === "active" ? effectiveActive : (indicatorBlock === "inactive" ? !effectiveActive : true)
readonly property bool inactiveRevealed: !effectiveActive && !!bar && bar.revealInactiveIndicators
readonly property bool inactiveRevealed: !effectiveActive && !!indicatorHost && indicatorHost.revealInactiveIndicators
function extractData(raw) {
var text = String(raw || "").trim()
@@ -49,6 +50,7 @@ WidgetButton {
interactive: belongsInBlock && (effectiveActive || indicatorBlock === "inactive" || inactiveRevealed)
useActiveColor: false
maintainIndicatorReveal: indicatorBlock === "inactive"
revealHost: indicatorHost
fontSize: Style.font.caption
horizontalMargin: 5
verticalPadding: 5
+5 -4
View File
@@ -24,6 +24,7 @@ Item {
property bool pressable: true
property bool useActiveColor: true
property bool maintainIndicatorReveal: false
property var revealHost: bar
property string tooltipText: ""
property var registeredBar: null
@@ -96,16 +97,16 @@ Item {
onEntered: {
if (root.bar) {
root.bar.showTooltip(root, root.tooltipText)
if (root.maintainIndicatorReveal && root.bar.setIndicatorItemHovered)
root.bar.setIndicatorItemHovered(true)
}
if (root.maintainIndicatorReveal && root.revealHost && root.revealHost.setIndicatorItemHovered)
root.revealHost.setIndicatorItemHovered(true)
}
onExited: {
if (root.bar) {
root.bar.hideTooltip(root)
if (root.maintainIndicatorReveal && root.bar.setIndicatorItemHovered)
root.bar.setIndicatorItemHovered(false)
}
if (root.maintainIndicatorReveal && root.revealHost && root.revealHost.setIndicatorItemHovered)
root.revealHost.setIndicatorItemHovered(false)
}
onClicked: function(mouse) { if (root.pressable) root.triggerPress(mouse.button) }
onWheel: function(wheel) { root.wheelMoved(wheel.angleDelta.y) }