From da92e16a9208dabf8cf9b9091f588462bfd63cf5 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Tue, 19 Sep 2023 13:46:53 +0200 Subject: [PATCH] QmlDesigner: Add tooltip on elided pills Change-Id: I4a40070b958a46e46009ba8f141fd5c286858ab7 Reviewed-by: Brook Cronin Reviewed-by: Thomas Hartmann Reviewed-by: Qt CI Patch Build Bot --- .../qmldesigner/connectionseditor/Pill.qml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/qmldesigner/connectionseditor/Pill.qml b/share/qtcreator/qmldesigner/connectionseditor/Pill.qml index d92163e9096..aa6cba03639 100644 --- a/share/qtcreator/qmldesigner/connectionseditor/Pill.qml +++ b/share/qtcreator/qmldesigner/connectionseditor/Pill.qml @@ -4,6 +4,7 @@ import QtQuick import StudioControls as StudioControls import StudioTheme as StudioTheme +import HelperWidgets as HelperWidgets FocusScope { id: root @@ -54,12 +55,25 @@ FocusScope { root.remove() } - MouseArea { + HelperWidgets.ToolTipArea { id: rootMouseArea anchors.fill: parent hoverEnabled: true cursorShape: root.isEditable() ? Qt.IBeamCursor : Qt.ArrowCursor onClicked: root.forceActiveFocus() + tooltip: { + if (textItem.visible) { + if (textItem.truncated) + return textItem.text + else + return "" + } + + if (textMetrics.width > textInput.width) + return textInput.text + + return "" + } } Rectangle {