Show long reaction text in tooltip

If the reaction text is elided, it will be shown in the tooltip.
pull/982/head
tastytea 3 years ago
parent a8734783cd
commit b82b724795
No known key found for this signature in database
  1. 9
      resources/qml/Reactions.qml

@ -33,12 +33,19 @@ Flow {
implicitWidth: contentItem.childrenRect.width + contentItem.leftPadding * 2 implicitWidth: contentItem.childrenRect.width + contentItem.leftPadding * 2
implicitHeight: contentItem.childrenRect.height implicitHeight: contentItem.childrenRect.height
ToolTip.visible: hovered ToolTip.visible: hovered
ToolTip.text: modelData.users
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
onClicked: { onClicked: {
console.debug("Picked " + modelData.key + "in response to " + reactionFlow.eventId + ". selfReactedEvent: " + modelData.selfReactedEvent); console.debug("Picked " + modelData.key + "in response to " + reactionFlow.eventId + ". selfReactedEvent: " + modelData.selfReactedEvent);
room.input.reaction(reactionFlow.eventId, modelData.key); 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 { contentItem: Row {
anchors.centerIn: parent anchors.centerIn: parent

Loading…
Cancel
Save