Fix tooltip layout with Qt 6.9

This commit is contained in:
Cameron Gutman 2025-04-05 00:27:50 -05:00
parent c93f7e7385
commit 75359bb1c4

View File

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