Skip to content
Snippets Groups Projects
Unverified Commit 5108955d authored by Malte E's avatar Malte E Committed by GitHub
Browse files

making userName_ an AbstractButton should play nicely with ListView (#961)

* making userName_ an AbstractButton should make it play nicely with the ListView

* make Avatar an AbstractButton

* make userName_ in Reply.qml an AbstractButton

* use alias for avatar background color and fix margin of username in reply
parent ebc0384e
No related branches found
No related tags found
No related merge requests found
Pipeline #2715 passed
......@@ -9,7 +9,7 @@ import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import im.nheko 1.0
Rectangle {
AbstractButton {
id: avatar
property string url
......@@ -18,13 +18,15 @@ Rectangle {
property string displayName
property alias textColor: label.color
property bool crop: true
signal clicked(var mouse)
property alias color: bg.color
width: 48
height: 48
radius: Settings.avatarCircles ? height / 2 : height / 8
color: Nheko.colors.alternateBase
background: Rectangle {
id: bg
radius: Settings.avatarCircles ? height / 2 : height / 8
color: Nheko.colors.alternateBase
}
Label {
id: label
......@@ -101,13 +103,6 @@ Rectangle {
cursorShape: Qt.PointingHandCursor
}
TapHandler {
id: mouseArea
onSingleTapped: avatar.clicked(eventPoint)
dragThreshold: 0
}
Ripple {
color: Qt.rgba(Nheko.colors.alternateBase.r, Nheko.colors.alternateBase.g, Nheko.colors.alternateBase.b, 0.5)
}
......
......@@ -302,14 +302,9 @@ Item {
displayName: userName
userid: userId
onClicked: room.openUserProfile(userId)
ToolTip.visible: avatarHover.hovered
ToolTip.visible: messageUserAvatar.hovered
ToolTip.delay: Nheko.tooltipDelay
ToolTip.text: userid
HoverHandler {
id: avatarHover
}
}
Connections {
......@@ -323,31 +318,23 @@ Item {
target: chat.model
}
Label {
id: userName_
text: TimelineManager.escapeEmoji(userName)
color: TimelineManager.userColor(userId, Nheko.colors.base)
textFormat: Text.RichText
ToolTip.visible: displayNameHover.hovered
AbstractButton {
contentItem: Label {
id: userName_
text: TimelineManager.escapeEmoji(userName)
color: TimelineManager.userColor(userId, Nheko.colors.base)
textFormat: Text.RichText
}
ToolTip.visible: hovered
ToolTip.delay: Nheko.tooltipDelay
ToolTip.text: userId
TapHandler {
onSingleTapped: chat.model.openUserProfile(userId)
dragThreshold: 0
}
onClicked: chat.model.openUserProfile(userId)
CursorShape {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
}
HoverHandler {
id: displayNameHover
}
}
Label {
......
......@@ -82,19 +82,16 @@ Item {
gesturePolicy: TapHandler.ReleaseWithinBounds
}
Text {
Layout.leftMargin: 4
AbstractButton {
id: userName_
Layout.leftMargin: 4
contentItem: Text {
text: TimelineManager.escapeEmoji(userName)
color: r.userColor
textFormat: Text.RichText
TapHandler {
onSingleTapped: room.openUserProfile(userId)
gesturePolicy: TapHandler.ReleaseWithinBounds
text: TimelineManager.escapeEmoji(userName)
color: r.userColor
textFormat: Text.RichText
}
onClicked: room.openUserProfile(userId)
}
MessageDelegate {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment