[ExpandableListItem] Load expanded view on demand
This commit is contained in:
parent
5d6cbd1de9
commit
4d5ff92b2c
@ -287,7 +287,7 @@ Item {
|
|||||||
* Show the expanded view, growing the list item to its taller size.
|
* Show the expanded view, growing the list item to its taller size.
|
||||||
*/
|
*/
|
||||||
function expand() {
|
function expand() {
|
||||||
expandedView.visible = true
|
expandedView.active = true
|
||||||
listItem.itemExpanded(listItem)
|
listItem.itemExpanded(listItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +296,7 @@ Item {
|
|||||||
* Hide the expanded view and collapse the list item to its shorter size.
|
* Hide the expanded view and collapse the list item to its shorter size.
|
||||||
*/
|
*/
|
||||||
function collapse() {
|
function collapse() {
|
||||||
expandedView.visible = false
|
expandedView.active = false
|
||||||
listItem.itemCollapsed(listItem)
|
listItem.itemCollapsed(listItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ Item {
|
|||||||
* Expand or collapse the list item depending on its current state.
|
* Expand or collapse the list item depending on its current state.
|
||||||
*/
|
*/
|
||||||
function toggleExpanded() {
|
function toggleExpanded() {
|
||||||
expandedView.visible ? listItem.collapse() : listItem.expand()
|
expandedView.active ? listItem.collapse() : listItem.expand()
|
||||||
}
|
}
|
||||||
|
|
||||||
signal itemExpanded(variant item)
|
signal itemExpanded(variant item)
|
||||||
@ -454,7 +454,7 @@ Item {
|
|||||||
enabled: listItem.isEnabled
|
enabled: listItem.isEnabled
|
||||||
visible: defaultActionButtonAction
|
visible: defaultActionButtonAction
|
||||||
&& listItem.defaultActionButtonVisible
|
&& listItem.defaultActionButtonVisible
|
||||||
&& (clickAndHoverHandler.containsMouse || expandedView.visible)
|
&& (clickAndHoverHandler.containsMouse || expandedView.active)
|
||||||
&& (!busyIndicator.visible || listItem.showDefaultActionButtonWhenBusy)
|
&& (!busyIndicator.visible || listItem.showDefaultActionButtonWhenBusy)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ Item {
|
|||||||
PlasmaComponents3.Button {
|
PlasmaComponents3.Button {
|
||||||
visible: clickAndHoverHandler.containsMouse || expandedView.visible
|
visible: clickAndHoverHandler.containsMouse || expandedView.visible
|
||||||
|
|
||||||
icon.name: expandedView.visible? "collapse" : "expand"
|
icon.name: expandedView.active? "collapse" : "expand"
|
||||||
|
|
||||||
onClicked: listItem.toggleExpanded()
|
onClicked: listItem.toggleExpanded()
|
||||||
}
|
}
|
||||||
@ -473,10 +473,10 @@ Item {
|
|||||||
Loader {
|
Loader {
|
||||||
id: expandedView
|
id: expandedView
|
||||||
|
|
||||||
visible: false
|
visible: active
|
||||||
opacity: visible ? 1.0 : 0
|
opacity: active ? 1.0 : 0
|
||||||
|
|
||||||
active: customExpandedViewContent != undefined
|
active: false
|
||||||
sourceComponent: customExpandedViewContent
|
sourceComponent: customExpandedViewContent
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user