Debian Codegraph @

resources/qml/components/UserListRow.qml

raw
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 import ".."
6 import QtQuick 2.12
7 import QtQuick.Controls 2.12
8 import QtQuick.Layouts 1.12
9 import im.nheko 1.0
10
11 ItemDelegate {
12 property alias bgColor: background.color
13 property alias userid: avatar.userid
14 property alias displayName: avatar.displayName
15 property string avatarUrl
16 implicitHeight: layout.implicitHeight + Nheko.paddingSmall * 2
17 background: Rectangle {id: background}
18 GridLayout {
19 id: layout
20 anchors.centerIn: parent
21 width: parent.width - Nheko.paddingSmall * 2
22 rows: 2
23 columns: 2
24 rowSpacing: Nheko.paddingSmall
25 columnSpacing: Nheko.paddingMedium
26
27 Avatar {
28 id: avatar
29 Layout.rowSpan: 2
30 Layout.preferredWidth: Nheko.avatarSize
31 Layout.preferredHeight: Nheko.avatarSize
32 Layout.alignment: Qt.AlignLeft
33 url: avatarUrl.replace("mxc://", "image://MxcImage/")
34 enabled: false
35 }
36 Label {
37 Layout.fillWidth: true
38 text: displayName
39 color: TimelineManager.userColor(userid, palette.window)
40 font.pointSize: fontMetrics.font.pointSize
41 }
42
43 Label {
44 Layout.fillWidth: true
45 Layout.alignment: Qt.AlignTop
46 text: userid
47 color: palette.buttonText
48 font.pointSize: fontMetrics.font.pointSize * 0.9
49 }
50 }
51 }