ExpandableListItem

Search for usage in LXR

ExpandableListItem Class Reference

Properties

bool allowStyledText
 
listTAction contextualActions
 
Component customExpandedViewContent
 
alias customExpandedViewContentItem
 
alias defaultActionButtonAction
 
bool defaultActionButtonVisible
 
alias expanded
 
bool hasExpandableContent
 
alias icon
 
alias iconEmblem
 
bool isBusy
 
bool isDefault
 
bool showDefaultActionButtonWhenBusy
 
alias subtitle
 
bool subtitleCanWrap
 
alias subtitleColor
 
alias title
 

Signals

void itemCollapsed ()
 
void itemExpanded ()
 

Public Member Functions

void collapse ()
 
void expand ()
 
void toggleExpanded ()
 

Detailed Description

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 {
icon.name: "configure"
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.

Property Documentation

◆ allowStyledText

bool ExpandableListItem::allowStyledText
read

Definition at line 139 of file ExpandableListItem.qml.

◆ contextualActions

listTAction ExpandableListItem::contextualActions
read

Definition at line 193 of file ExpandableListItem.qml.

◆ customExpandedViewContent

Component ExpandableListItem::customExpandedViewContent
read

Definition at line 205 of file ExpandableListItem.qml.

◆ customExpandedViewContentItem

alias ExpandableListItem::customExpandedViewContentItem
read

Definition at line 210 of file ExpandableListItem.qml.

◆ defaultActionButtonAction

alias ExpandableListItem::defaultActionButtonAction
read

Definition at line 146 of file ExpandableListItem.qml.

◆ defaultActionButtonVisible

bool ExpandableListItem::defaultActionButtonVisible
read

Definition at line 154 of file ExpandableListItem.qml.

◆ expanded

alias ExpandableListItem::expanded
read

expanded: bool Whether the expanded view is visible.

Since
5.98
Remarks
This property is read-only

Definition at line 236 of file ExpandableListItem.qml.

◆ hasExpandableContent

bool ExpandableListItem::hasExpandableContent
read
Remarks
This property is read-only

Definition at line 244 of file ExpandableListItem.qml.

◆ icon

alias ExpandableListItem::icon
read

icon: var The name of the icon used in the list item.

See also
Kirigami.Icon::source

Required.

Definition at line 92 of file ExpandableListItem.qml.

◆ iconEmblem

alias ExpandableListItem::iconEmblem
read

iconEmblem: var The name of the emblem to badge the icon with.

See also
Kirigami.Icon::source

Optional, defaults to nothing, in which case there is no emblem.

Definition at line 100 of file ExpandableListItem.qml.

◆ isBusy

bool ExpandableListItem::isBusy
read

Definition at line 218 of file ExpandableListItem.qml.

◆ isDefault

bool ExpandableListItem::isDefault
read

Definition at line 228 of file ExpandableListItem.qml.

◆ showDefaultActionButtonWhenBusy

bool ExpandableListItem::showDefaultActionButtonWhenBusy
read

Definition at line 163 of file ExpandableListItem.qml.

◆ subtitle

alias ExpandableListItem::subtitle
read

Definition at line 116 of file ExpandableListItem.qml.

◆ subtitleCanWrap

bool ExpandableListItem::subtitleCanWrap
read

Definition at line 124 of file ExpandableListItem.qml.

◆ subtitleColor

alias ExpandableListItem::subtitleColor
read

Definition at line 131 of file ExpandableListItem.qml.

◆ title

alias ExpandableListItem::title
read

Definition at line 108 of file ExpandableListItem.qml.


The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:34:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.