org::kde::plasma::extras::ExpandableListItem

Search for usage in LXR

org::kde::plasma::extras::ExpandableListItem Class Reference

Inherits Item.

Properties

bool allowStyledText
 
var contextMenu
 
list< QtObject > contextualActionsModel
 
var customExpandedViewContent
 
alias customExpandedViewContentItem
 
alias defaultActionButtonAction
 
bool defaultActionButtonVisible
 
int enabledActions
 
alias expanded
 
bool hasExpandableContent
 
alias icon
 
alias iconEmblem
 
bool iconUsesPlasmaSVG
 
bool isBusy
 
bool isDefault
 
alias isEnabled
 
bool showDefaultActionButtonWhenBusy
 
alias subtitle
 
bool subtitleCanWrap
 
alias subtitleColor
 
alias title
 

Signals

void itemCollapsed (Item item)
 
void itemExpanded (Item item)
 

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.

Since
2.0 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 contextualActionsModel 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 org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.components 3.0 as PlasmaComponents
[...]
PlasmaComponents.ScrollView {
ListView {
anchors.fill: parent
focus: true
currentIndex: -1
clip: true
model: myModel
highlight: PlasmaExtras.Highlight {}
highlightMoveDuration: PlasmaCore.Units.longDuration
highlightResizeDuration: PlasmaCore.Units.longDuration
delegate: PlasmaExtras.ExpandableListItem {
icon: model.iconName
iconEmblem: model.isPaused ? "emblem-pause" : ""
title: model.name
subtitle: model.subtitle
isDefault: model.isDefault
defaultActionButtonAction: 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);
}
}
}
contextualActionsModel: [
icon.name: "configure"
text: "Configure..."
onTriggered: model.configure(model.name);
}
]
}
}
}
[...]

Definition at line 80 of file ExpandableListItem.qml.

Property Documentation

◆ enabledActions

int org::kde::plasma::extras::ExpandableListItem::enabledActions
read
Remarks
This property is read-only

Definition at line 272 of file ExpandableListItem.qml.

◆ expanded

alias org::kde::plasma::extras::ExpandableListItem::expanded
read

expanded: bool Whether the expanded view is visible.

Since
5.98
Remarks
This property is read-only

Definition at line 280 of file ExpandableListItem.qml.

◆ hasExpandableContent

bool org::kde::plasma::extras::ExpandableListItem::hasExpandableContent
read
Remarks
This property is read-only

Definition at line 288 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-2023 The KDE developers.
Generated on Tue Jun 6 2023 04:06:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.