From f4005ed52ce412720224938f9ae11c3f51dd1402 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Mon, 7 Jun 2021 12:56:24 +0200 Subject: [PATCH] feat(StatusListItem) expose content children and introduce padding properties These properties are needed to enable more control over how a list item implementation can look like. Content children are exposed as follows: ```qml StatusListItem { statusListItemTitle.[...]: ... // StatusBaseText sensor.[...]: ... // MouseArea rightPadding: ... // default 16 leftPadding: .. // default 16 } ``` --- ui/StatusQ/src/StatusQ/Components/StatusListItem.qml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/StatusQ/src/StatusQ/Components/StatusListItem.qml b/ui/StatusQ/src/StatusQ/Components/StatusListItem.qml index 7e06e5a32a..f1b85a0a15 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusListItem.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusListItem.qml @@ -15,6 +15,8 @@ Rectangle { property string title: "" property string subTitle: "" + property real leftPadding: 16 + property real rightPadding: 16 property StatusIconSettings icon: StatusIconSettings { height: 20 width: 20 @@ -27,6 +29,10 @@ Rectangle { property StatusImageSettings image: StatusImageSettings {} property string label: "" + property alias sensor: sensor + property alias statusListItemTitle: statusListItemTitle + property alias statusListItemComponentsSlot: statusListItemComponentsSlot + property list components onComponentsChanged: { @@ -47,7 +53,7 @@ Rectangle { Loader { id: iconOrImage anchors.left: parent.left - anchors.leftMargin: 16 + anchors.leftMargin: statusListItem.leftPadding anchors.verticalCenter: parent.verticalCenter sourceComponent: !!statusListItem.icon.name ? statusRoundedIcon : statusRoundedImage active: !!statusListItem.icon.name || !!statusListItem.image.source.toString() @@ -74,7 +80,7 @@ Rectangle { Item { anchors.left: iconOrImage.active ? iconOrImage.right : parent.left - anchors.leftMargin: 16 + anchors.leftMargin: statusListItem.leftPadding anchors.verticalCenter: parent.verticalCenter height: statusListItemTitle.height + (statusListItemSubTitle.visible ? statusListItemSubTitle.height : 0) @@ -111,7 +117,7 @@ Rectangle { Row { id: statusListItemComponentsSlot anchors.right: parent.right - anchors.rightMargin: 16 + anchors.rightMargin: statusListItem.rightPadding anchors.verticalCenter: parent.verticalCenter spacing: 10 }