Merge pull request #982 from tastytea/reaction-tooltip

Show long reaction text in tooltip; Remove extra …
pull/985/head
DeepBlueV7.X 3 years ago committed by GitHub
commit 64a939481a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      resources/qml/Reactions.qml

@ -33,12 +33,19 @@ Flow {
implicitWidth: contentItem.childrenRect.width + contentItem.leftPadding * 2
implicitHeight: contentItem.childrenRect.height
ToolTip.visible: hovered
ToolTip.text: modelData.users
ToolTip.delay: Nheko.tooltipDelay
onClicked: {
console.debug("Picked " + modelData.key + "in response to " + reactionFlow.eventId + ". selfReactedEvent: " + modelData.selfReactedEvent);
room.input.reaction(reactionFlow.eventId, modelData.key);
}
Component.onCompleted: {
ToolTip.text = Qt.binding(function() {
if (textMetrics.elidedText === textMetrics.text) {
return modelData.users;
}
return modelData.displayKey + "\n" + modelData.users;
})
}
contentItem: Row {
anchors.centerIn: parent
@ -59,7 +66,15 @@ Flow {
id: reactionText
anchors.baseline: reactionCounter.baseline
text: textMetrics.elidedText + (textMetrics.elidedText == modelData.displayKey ? "" : "…")
text: {
// When an emoji font is selected that doesn't have , it is dropped from elidedText. So we add it back.
if (textMetrics.elidedText !== modelData.displayKey) {
if (!textMetrics.elidedText.endsWith("…")) {
return textMetrics.elidedText + "…";
}
}
return textMetrics.elidedText;
}
font.family: Settings.emojiFont
color: reaction.hovered ? Nheko.colors.highlight : Nheko.colors.text
maximumLineCount: 1

Loading…
Cancel
Save