Hide disabled contextual actions from ExpandableListItem

The concept of a disabled contextual item is nonsensical;
the set of context-sensitive actions is always supposed to be responsive
to the context. Accordingly, if the calling code has marked any actions
as disabled, let's hide them entirely.

We can't remove them from the model because they might become re-enabled
at a time when the calling app sees fit (perhaps the context has
changed). So instead we have to set visible to false and height to 0, to
ensure that the listview has the correct height. This is a hack, but I
don't see a better way to do it.

The memory penalty to having invisible but created items should be
negligible since there are only ever a maximum of about 3 items in here.
This commit is contained in:
Nate Graham 2020-12-08 15:47:22 -07:00
parent 26eb310175
commit 08c5cb671d

View File

@ -520,10 +520,10 @@ Item {
delegate: MouseArea {
id: actionItem
enabled: model.enabled
visible: model.enabled
width: actionsList.width
height: actionItemLayout.height + PlasmaCore.Units.smallSpacing * 2
height: visible ? actionItemLayout.height + PlasmaCore.Units.smallSpacing * 2 : 0
hoverEnabled: true