From e607ae7b92917f83f65310e433524ac1308d18e7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 26 Jan 2022 11:24:41 +0100 Subject: [PATCH] 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. --- resources/qml/TableView.qml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/resources/qml/TableView.qml b/resources/qml/TableView.qml index 079e25d717..8dc7cce713 100644 --- a/resources/qml/TableView.qml +++ b/resources/qml/TableView.qml @@ -132,14 +132,25 @@ Item font: UM.Theme.getFont("default") 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 - enabled: tableBase.allowSelection + text: (cellTextMetrics.elidedText == cellContent.text) ? "" : cellContent.text //Show full text in tooltip if it was elided. onClicked: { - tableBase.currentRow = row; //Select this row. + if(tableBase.allowSelection) + { + tableBase.currentRow = row; //Select this row. + } } onDoubleClicked: {