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,7 +58,21 @@ ApplicationWindow {
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
model: readReceipts model: readReceipts
delegate: RowLayout { delegate: ItemDelegate {
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
}
RowLayout {
id: receiptLayout
spacing: Nheko.paddingMedium spacing: Nheko.paddingMedium
Avatar { Avatar {
@ -67,14 +81,6 @@ ApplicationWindow {
userid: model.mxid userid: model.mxid
url: model.avatarUrl.replace("mxc://", "image://MxcImage/") url: model.avatarUrl.replace("mxc://", "image://MxcImage/")
displayName: model.displayName displayName: model.displayName
onClicked: room.openUserProfile(model.mxid)
ToolTip.visible: avatarHover.hovered
ToolTip.text: model.mxid
HoverHandler {
id: avatarHover
}
} }
ColumnLayout { ColumnLayout {
@ -84,22 +90,6 @@ ApplicationWindow {
text: model.displayName text: model.displayName
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window) color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
font.pointSize: fontMetrics.font.pointSize 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 { Label {
@ -117,6 +107,13 @@ ApplicationWindow {
} }
CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}
}
} }
} }