From 75359bb1c483ba9e52bba8c34a662d807e0cc3c4 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 5 Apr 2025 00:27:50 -0500 Subject: [PATCH] Fix tooltip layout with Qt 6.9 --- app/gui/main.qml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/gui/main.qml b/app/gui/main.qml index 3a204f94..54aefe8f 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -69,9 +69,19 @@ ApplicationWindow { } } + // It would be better to use TextMetrics here, but it always lays out + // the text slightly more compactly than real Text does in ToolTip, + // causing unexpected line breaks to be inserted + Text { + id: tooltipTextLayoutHelper + visible: false + font: ToolTip.toolTip.font + text: ToolTip.toolTip.text + } + // This configures the maximum width of the singleton attached QML ToolTip. If left unconstrained, // it will never insert a line break and just extend on forever. - ToolTip.toolTip.contentWidth: ToolTip.toolTip.implicitContentWidth < 400 ? ToolTip.toolTip.implicitContentWidth : 400 + ToolTip.toolTip.contentWidth: Math.min(tooltipTextLayoutHelper.width, 400) function goBack() { if (clearOnBack) {