Show long reaction text in tooltip

If the reaction text is elided, it will be shown in the tooltip.
This commit is contained in:
tastytea 2022-03-09 10:25:23 +01:00
parent a8734783cd
commit b82b724795
No known key found for this signature in database
1 changed files with 8 additions and 1 deletions

View File

@ -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