Show tooltip if text got elided

This way you can still see the whole text, even if the cell is too small. Handy.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-26 11:24:41 +01:00
parent f22fea5f22
commit e607ae7b92
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -132,14 +132,25 @@ Item
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
} }
MouseArea TextMetrics
{
id: cellTextMetrics
text: cellContent.text
font: cellContent.font
elide: cellContent.elide
elideWidth: cellContent.width
}
UM.TooltipArea
{ {
anchors.fill: parent anchors.fill: parent
enabled: tableBase.allowSelection text: (cellTextMetrics.elidedText == cellContent.text) ? "" : cellContent.text //Show full text in tooltip if it was elided.
onClicked: onClicked:
{ {
tableBase.currentRow = row; //Select this row. if(tableBase.allowSelection)
{
tableBase.currentRow = row; //Select this row.
}
} }
onDoubleClicked: onDoubleClicked:
{ {