Use ItemDelegate for read receipts

This commit is contained in:
Loren Burkholder 2021-11-05 19:35:13 -04:00
parent 3758c42ed6
commit b5b5c95246

View file

@ -58,61 +58,58 @@ ApplicationWindow {
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
model: readReceipts model: readReceipts
delegate: RowLayout { delegate: ItemDelegate {
spacing: Nheko.paddingMedium onClicked: room.openUserProfile(model.mxid)
padding: Nheko.paddingMedium
width: receiptLayout.implicitWidth
height: receiptLayout.implicitHeight
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: model.mxid
background: Rectangle {
color: readReceiptsRoot.color
}
Avatar { RowLayout {
width: Nheko.avatarSize id: receiptLayout
height: Nheko.avatarSize
userid: model.mxid spacing: Nheko.paddingMedium
url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
displayName: model.displayName Avatar {
onClicked: room.openUserProfile(model.mxid) width: Nheko.avatarSize
ToolTip.visible: avatarHover.hovered height: Nheko.avatarSize
ToolTip.text: model.mxid userid: model.mxid
url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
displayName: model.displayName
}
ColumnLayout {
spacing: Nheko.paddingSmall
Label {
text: model.displayName
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
font.pointSize: fontMetrics.font.pointSize
}
Label {
text: model.timestamp
color: Nheko.colors.buttonText
font.pointSize: fontMetrics.font.pointSize * 0.9
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
HoverHandler {
id: avatarHover
} }
} }
ColumnLayout { CursorShape {
spacing: Nheko.paddingSmall anchors.fill: parent
cursorShape: Qt.PointingHandCursor
Label {
text: model.displayName
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
font.pointSize: fontMetrics.font.pointSize
ToolTip.visible: displayNameHover.hovered
ToolTip.text: model.mxid
TapHandler {
onSingleTapped: room.openUserProfile(userId)
}
CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}
HoverHandler {
id: displayNameHover
}
}
Label {
text: model.timestamp
color: Nheko.colors.buttonText
font.pointSize: fontMetrics.font.pointSize * 0.9
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
}
} }
} }