I think I may have finally worked out a way to do this. In the ActionBarActionDelegate I need to latch onto the enabled property and then effectively export this by emitting a signal for the ActionBar to handle. It can handle it by setting the int property to the appropriate action button count.
in ActionBarActionDelegate:
Item {
property int actionIndex: 0 // Index of the action in the action bar list (if set)
property Action action
property alias iconHeight: actionButton.height
signal activationChanged(int actionIndex, bool active)
id: actionButton
height: 70
width: height
onEnabledChanged: activationChanged(actionIndex, enabled)
...
and in ActionBar
ActionBarActionDelegate {
iconHeight: barHeight * 0.9
actionIndex: index
action: Action {
iconSource: modelData.iconSource
text: modelData.text
onTriggered: { modelData.triggered(); }
}
// Does action icon overlap with the title text?
// Disable (and implicitly hide) actions that would overlap the title text
enabled: ((titletext.x + titletext.width) < (actionsRow.x + actionsRow.children[index].x))
onActivationChanged: {
if (active && actionIndex < overflowCount)
overflowCount = actionIndex
else if (!active && actionIndex >= overflowCount)
overflowCount = actionIndex + 1
console.log("Activated on index:", actionIndex, "as", active, "overflowCount:", overflowCount)
}
}
↧