Stabilize indicator activation rendering
This commit is contained in:
@@ -11,8 +11,10 @@ WidgetButton {
|
|||||||
property string activeTooltipText: ""
|
property string activeTooltipText: ""
|
||||||
property string inactiveTooltipText: activeTooltipText
|
property string inactiveTooltipText: activeTooltipText
|
||||||
property string indicatorBlock: "single"
|
property string indicatorBlock: "single"
|
||||||
readonly property bool belongsInBlock: indicatorBlock === "active" ? active : (indicatorBlock === "inactive" ? !active : true)
|
property var activeOverride: null
|
||||||
readonly property bool inactiveRevealed: !active && !!bar && bar.revealInactiveIndicators
|
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
|
||||||
|
|
||||||
function extractData(raw) {
|
function extractData(raw) {
|
||||||
var text = String(raw || "").trim()
|
var text = String(raw || "").trim()
|
||||||
@@ -32,18 +34,19 @@ WidgetButton {
|
|||||||
|
|
||||||
Component.onCompleted: syncIndicatorOpacity()
|
Component.onCompleted: syncIndicatorOpacity()
|
||||||
onActiveChanged: syncIndicatorOpacity()
|
onActiveChanged: syncIndicatorOpacity()
|
||||||
|
onEffectiveActiveChanged: syncIndicatorOpacity()
|
||||||
onBarChanged: syncIndicatorOpacity()
|
onBarChanged: syncIndicatorOpacity()
|
||||||
onBelongsInBlockChanged: syncIndicatorOpacity()
|
onBelongsInBlockChanged: syncIndicatorOpacity()
|
||||||
onInactiveRevealedChanged: syncIndicatorOpacity()
|
onInactiveRevealedChanged: syncIndicatorOpacity()
|
||||||
onIndicatorBlockChanged: syncIndicatorOpacity()
|
onIndicatorBlockChanged: syncIndicatorOpacity()
|
||||||
|
|
||||||
visible: belongsInBlock && (text !== "" || keepSpace)
|
visible: belongsInBlock && (text !== "" || keepSpace)
|
||||||
text: active ? activeText : inactiveText
|
text: effectiveActive ? activeText : inactiveText
|
||||||
tooltipText: active ? activeTooltipText : inactiveTooltipText
|
tooltipText: effectiveActive ? activeTooltipText : inactiveTooltipText
|
||||||
keepSpace: true
|
keepSpace: true
|
||||||
dimmed: !active
|
dimmed: !effectiveActive
|
||||||
concealed: !active && !inactiveRevealed
|
concealed: !effectiveActive && !inactiveRevealed
|
||||||
interactive: belongsInBlock && (active || indicatorBlock === "inactive" || inactiveRevealed)
|
interactive: belongsInBlock && (effectiveActive || indicatorBlock === "inactive" || inactiveRevealed)
|
||||||
useActiveColor: false
|
useActiveColor: false
|
||||||
maintainIndicatorReveal: indicatorBlock === "inactive"
|
maintainIndicatorReveal: indicatorBlock === "inactive"
|
||||||
fontSize: Style.font.caption
|
fontSize: Style.font.caption
|
||||||
|
|||||||
@@ -1204,6 +1204,7 @@ Item {
|
|||||||
indicatorEntries: indicatorsRoot.activeIndicatorEntries
|
indicatorEntries: indicatorsRoot.activeIndicatorEntries
|
||||||
indicatorBlock: "active"
|
indicatorBlock: "active"
|
||||||
horizontal: true
|
horizontal: true
|
||||||
|
reportActiveState: !root.vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -1241,6 +1242,7 @@ Item {
|
|||||||
indicatorEntries: indicatorsRoot.activeIndicatorEntries
|
indicatorEntries: indicatorsRoot.activeIndicatorEntries
|
||||||
indicatorBlock: "active"
|
indicatorBlock: "active"
|
||||||
horizontal: false
|
horizontal: false
|
||||||
|
reportActiveState: root.vertical
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -1337,6 +1339,7 @@ Item {
|
|||||||
property var indicatorsModule: null
|
property var indicatorsModule: null
|
||||||
required property string indicatorBlock
|
required property string indicatorBlock
|
||||||
property bool reportActiveState: false
|
property bool reportActiveState: false
|
||||||
|
property bool activeStateObserved: false
|
||||||
readonly property string indicatorId: root.entryId(entry)
|
readonly property string indicatorId: root.entryId(entry)
|
||||||
readonly property var indicatorSettings: root.entrySettings(entry)
|
readonly property var indicatorSettings: root.entrySettings(entry)
|
||||||
|
|
||||||
@@ -1345,6 +1348,7 @@ Item {
|
|||||||
width: implicitWidth
|
width: implicitWidth
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
onEntryChanged: {
|
onEntryChanged: {
|
||||||
|
activeStateObserved = false
|
||||||
injectProps()
|
injectProps()
|
||||||
syncActiveState()
|
syncActiveState()
|
||||||
}
|
}
|
||||||
@@ -1378,11 +1382,19 @@ Item {
|
|||||||
if ("moduleName" in target) target.moduleName = indicatorId
|
if ("moduleName" in target) target.moduleName = indicatorId
|
||||||
if ("settings" in target) target.settings = indicatorSettings
|
if ("settings" in target) target.settings = indicatorSettings
|
||||||
if ("indicatorBlock" in target) target.indicatorBlock = indicatorBlock
|
if ("indicatorBlock" in target) target.indicatorBlock = indicatorBlock
|
||||||
|
if ("activeOverride" in target) target.activeOverride = indicatorBlock === "active" ? true : null
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncActiveState() {
|
function syncActiveState() {
|
||||||
if (!reportActiveState || !indicatorsModule || !indicatorsModule.setIndicatorActive) return
|
if (!reportActiveState || !indicatorsModule || !indicatorsModule.setIndicatorActive) return
|
||||||
indicatorsModule.setIndicatorActive(entry, !!indicatorSource.item && indicatorSource.item.active === true)
|
|
||||||
|
var active = !!indicatorSource.item && indicatorSource.item.active === true
|
||||||
|
if (indicatorBlock === "active") {
|
||||||
|
if (active) activeStateObserved = true
|
||||||
|
else if (!activeStateObserved) return
|
||||||
|
}
|
||||||
|
|
||||||
|
indicatorsModule.setIndicatorActive(entry, active)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user