From f915526b2c43f1f14f913dfe193ca5c463ba738b Mon Sep 17 00:00:00 2001 From: Jan Blackquill Date: Tue, 13 Apr 2021 17:35:45 -0400 Subject: [PATCH] kcms/users: port to BasicListItem w/ leading property Now that the BasicListItem provides for the layout w/ leading avatar design, we don't need a custom contentItem in order to have it. --- kcms/users/package/contents/ui/main.qml | 69 +++++++++---------------- 1 file changed, 24 insertions(+), 45 deletions(-) diff --git a/kcms/users/package/contents/ui/main.qml b/kcms/users/package/contents/ui/main.qml index 51daa5de0..d572d1986 100644 --- a/kcms/users/package/contents/ui/main.qml +++ b/kcms/users/package/contents/ui/main.qml @@ -69,51 +69,9 @@ KCM.ScrollViewKCM { } } - delegate: Kirigami.AbstractListItem { - width: userList.width - Kirigami.Theme.colorSet: highlighted ? Kirigami.Theme.Selection : Kirigami.Theme.View - contentItem: RowLayout { - spacing: Kirigami.Units.largeSpacing - - Rectangle { - height: col.height - width: height - - color: "transparent" - border.color: Kirigami.ColorUtils.adjustColor(Kirigami.Theme.textColor, {alpha: 0.4*255}) - border.width: 1 - radius: height/2 - - Kirigami.Avatar { - source: model.decoration + '?' + avatarVersion // force reload after saving - cache: false // avoid caching - name: model.display - anchors { - fill: parent - margins: 1 - } - } - } - - ColumnLayout { - id: col - - Layout.fillWidth: true - - Kirigami.Heading { - level: 3 - text: model.display - elide: Text.ElideMiddle - Layout.fillWidth: true - } - QQC2.Label { - text: model.name - opacity: 0.8 - elide: Text.ElideMiddle - Layout.fillWidth: true - } - } - } + delegate: Kirigami.BasicListItem { + text: model.display + subtitle: model.name highlighted: index == userList.currentIndex @@ -124,6 +82,27 @@ KCM.ScrollViewKCM { } onClicked: openPage() + + Kirigami.Theme.colorSet: highlighted ? Kirigami.Theme.Selection : Kirigami.Theme.View + + leading: Rectangle { + width: height + + color: "transparent" + border.color: Kirigami.ColorUtils.adjustColor(Kirigami.Theme.textColor, {alpha: 0.4*255}) + border.width: 1 + radius: height/2 + + Kirigami.Avatar { + source: model.decoration + '?' + avatarVersion // force reload after saving + cache: false // avoid caching + name: model.display + anchors { + fill: parent + margins: 1 + } + } + } } }