Always show ExpandableListitem buttons, not just on hover

Hover buttons suffer from discoverability problems and can't be used on
touch, and this component is explicitly trying to be touch-friendly. So
let's make the buttons always be visible, not just on hover.

To avoid the appearance becoming too heavy, the Buttons are turned
into ToolButtons.

BUG: 428624
FIXED-IN: 5.76
This commit is contained in:
Nate Graham 2020-11-04 13:32:08 -07:00
parent b96f23cd3a
commit e845f3dbcc

View File

@ -328,10 +328,8 @@ Item {
} }
} }
// We still need a MouseArea to handle mouse hover and right-click // We still need a MouseArea to handle right-click
MouseArea { MouseArea {
id: clickAndHoverHandler
anchors.fill: parent anchors.fill: parent
enabled: listItem.isEnabled enabled: listItem.isEnabled
@ -448,20 +446,17 @@ Item {
} }
// Default action button // Default action button
PlasmaComponents3.Button { PlasmaComponents3.ToolButton {
id: defaultActionButton id: defaultActionButton
enabled: listItem.isEnabled enabled: listItem.isEnabled
visible: defaultActionButtonAction visible: defaultActionButtonAction
&& listItem.defaultActionButtonVisible && listItem.defaultActionButtonVisible
&& (clickAndHoverHandler.containsMouse || expandedView.active)
&& (!busyIndicator.visible || listItem.showDefaultActionButtonWhenBusy) && (!busyIndicator.visible || listItem.showDefaultActionButtonWhenBusy)
} }
// Expand/collapse button // Expand/collapse button
PlasmaComponents3.Button { PlasmaComponents3.ToolButton {
visible: clickAndHoverHandler.containsMouse || expandedView.visible
icon.name: expandedView.active? "collapse" : "expand" icon.name: expandedView.active? "collapse" : "expand"
onClicked: listItem.toggleExpanded() onClicked: listItem.toggleExpanded()