A list item that expands when clicked to show additional actions and/or a custom view.
The list item has a standardized appearance, with an icon on the left badged with an optional emblem, a title and optional subtitle to the right, an optional default action button, and a button to expand and collapse the list item.
When expanded, the list item shows a list of contextually-appropriate actions if contextualActions has been defined. If customExpandedViewContent has been defined, it will show a custom view. If both have been defined, it shows both, with the actions above the custom view.
It is not valid to define neither; define one or both.
Note: this component should only be used for lists where the maximum number of items is very low, ideally less than 10. For longer lists, consider using a different paradigm.
Example usage:
import QtQuick
import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami
import org.kde.plasma.extras as PlasmaExtras
import org.kde.plasma.components as PlasmaComponents
PlasmaComponents.ScrollView {
ListView {
anchors.fill: parent
focus: true
currentIndex: -1
clip: true
model: myModel
highlight: PlasmaExtras.Highlight {}
highlightMoveDuration: Kirigami.Units.shortDuration
highlightResizeDuration: Kirigami.Units.shortDuration
delegate: PlasmaExtras.ExpandableListItem {
icon: model.iconName
iconEmblem: model.isPaused ? "emblem-pause" : ""
title: model.name
subtitle: model.subtitle
isDefault: model.isDefault
defaultActionButtonAction: QQC2.Action {
icon.name: model.isPaused ?
"media-playback-start" :
"media-playback-pause"
text: model.isPaused ? "Resume" : "Pause"
onTriggered: {
if (model.isPaused) {
model.resume(model.name);
} else {
model.pause(model.name);
}
}
}
contextualActions: [
QQC2.Action {
text: "Configureā¦"
onTriggered: model.configure(model.name);
}
]
}
}
}
alias icon
icon: var The name of the icon used in the list item.
Definition at line 83 of file ExpandableListItem.qml.