mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Render custom reactions
This commit is contained in:
parent
f48c696baf
commit
2f1b3519d3
1 changed files with 12 additions and 6 deletions
|
@ -26,8 +26,6 @@ Flow {
|
||||||
id: reaction
|
id: reaction
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
implicitWidth: contentItem.childrenRect.width + contentItem.leftPadding * 2
|
|
||||||
implicitHeight: contentItem.childrenRect.height
|
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -42,12 +40,11 @@ Flow {
|
||||||
return modelData.displayKey + "\n" + modelData.users;
|
return modelData.displayKey + "\n" + modelData.users;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
leftPadding: textMetrics.height / 2
|
||||||
|
rightPadding: textMetrics.height / 2
|
||||||
|
|
||||||
contentItem: Row {
|
contentItem: Row {
|
||||||
anchors.centerIn: parent
|
spacing: textMetrics.height / 4
|
||||||
spacing: reactionText.implicitHeight / 4
|
|
||||||
leftPadding: reactionText.implicitHeight / 2
|
|
||||||
rightPadding: reactionText.implicitHeight / 2
|
|
||||||
|
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: textMetrics
|
id: textMetrics
|
||||||
|
@ -74,6 +71,15 @@ Flow {
|
||||||
font.family: Settings.emojiFont
|
font.family: Settings.emojiFont
|
||||||
color: (reaction.hovered || modelData.selfReactedEvent !== '') ? Nheko.colors.highlightedText: Nheko.colors.text
|
color: (reaction.hovered || modelData.selfReactedEvent !== '') ? Nheko.colors.highlightedText: Nheko.colors.text
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
|
visible: !modelData.key.startsWith("mxc://")
|
||||||
|
}
|
||||||
|
Image {
|
||||||
|
anchors.verticalCenter: divider.verticalCenter
|
||||||
|
height: textMetrics.height
|
||||||
|
width: textMetrics.height
|
||||||
|
source: modelData.key.startsWith("mxc://") ? (modelData.key.replace("mxc://", "image://MxcImage/") + "?scale") : ""
|
||||||
|
visible: modelData.key.startsWith("mxc://")
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
Loading…
Reference in a new issue