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 ...@@ -9,7 +9,7 @@ import QtQuick.Controls 2.15
import QtQuick.Window 2.15 import QtQuick.Window 2.15
import im.nheko 1.0 import im.nheko 1.0
Rectangle { AbstractButton {
id: avatar id: avatar
property string url property string url
...@@ -18,13 +18,15 @@ Rectangle { ...@@ -18,13 +18,15 @@ Rectangle {
property string displayName property string displayName
property alias textColor: label.color property alias textColor: label.color
property bool crop: true property bool crop: true
property alias color: bg.color
signal clicked(var mouse)
width: 48 width: 48
height: 48 height: 48
radius: Settings.avatarCircles ? height / 2 : height / 8 background: Rectangle {
color: Nheko.colors.alternateBase id: bg
radius: Settings.avatarCircles ? height / 2 : height / 8
color: Nheko.colors.alternateBase
}
Label { Label {
id: label id: label
...@@ -101,13 +103,6 @@ Rectangle { ...@@ -101,13 +103,6 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
} }
TapHandler {
id: mouseArea
onSingleTapped: avatar.clicked(eventPoint)
dragThreshold: 0
}
Ripple { Ripple {
color: Qt.rgba(Nheko.colors.alternateBase.r, Nheko.colors.alternateBase.g, Nheko.colors.alternateBase.b, 0.5) color: Qt.rgba(Nheko.colors.alternateBase.r, Nheko.colors.alternateBase.g, Nheko.colors.alternateBase.b, 0.5)
} }
......
...@@ -302,14 +302,9 @@ Item { ...@@ -302,14 +302,9 @@ Item {
displayName: userName displayName: userName
userid: userId userid: userId
onClicked: room.openUserProfile(userId) onClicked: room.openUserProfile(userId)
ToolTip.visible: avatarHover.hovered ToolTip.visible: messageUserAvatar.hovered
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
ToolTip.text: userid ToolTip.text: userid
HoverHandler {
id: avatarHover
}
} }
Connections { Connections {
...@@ -323,31 +318,23 @@ Item { ...@@ -323,31 +318,23 @@ Item {
target: chat.model target: chat.model
} }
AbstractButton {
Label { contentItem: Label {
id: userName_ id: userName_
text: TimelineManager.escapeEmoji(userName)
text: TimelineManager.escapeEmoji(userName) color: TimelineManager.userColor(userId, Nheko.colors.base)
color: TimelineManager.userColor(userId, Nheko.colors.base) textFormat: Text.RichText
textFormat: Text.RichText }
ToolTip.visible: displayNameHover.hovered ToolTip.visible: hovered
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
ToolTip.text: userId ToolTip.text: userId
onClicked: chat.model.openUserProfile(userId)
TapHandler {
onSingleTapped: chat.model.openUserProfile(userId)
dragThreshold: 0
}
CursorShape { CursorShape {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
} }
HoverHandler {
id: displayNameHover
}
} }
Label { Label {
......
...@@ -82,19 +82,16 @@ Item { ...@@ -82,19 +82,16 @@ Item {
gesturePolicy: TapHandler.ReleaseWithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds
} }
Text { AbstractButton {
Layout.leftMargin: 4
id: userName_ id: userName_
Layout.leftMargin: 4
contentItem: Text {
text: TimelineManager.escapeEmoji(userName) text: TimelineManager.escapeEmoji(userName)
color: r.userColor color: r.userColor
textFormat: Text.RichText textFormat: Text.RichText
TapHandler {
onSingleTapped: room.openUserProfile(userId)
gesturePolicy: TapHandler.ReleaseWithinBounds
} }
onClicked: room.openUserProfile(userId)
} }
MessageDelegate { 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