Skip to content

Commit c3c37b4

Browse files
committed
Fix tooltip text wrapping
Also set the hiding delay to a reasonable time. Fixes: QTBUG-76122 Change-Id: Id971edbd9fb87cc96df53f73f2e7c61bde5855ef Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 9dce1c5 commit c3c37b4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/webengine/ui/ToolTip.qml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ Item {
4747
visible: false
4848

4949
property alias text: toolTip.text
50-
property int delayTimerInterval: 1000
51-
property int hideTimerInterval: 1500
50+
property int delayTimerInterval: 500
51+
property int hideTimerInterval: 10000
52+
property int toolTipMaxWidth: 400
5253

5354
Timer {
5455
id: delayTimer
@@ -77,7 +78,8 @@ Item {
7778
Text {
7879
id: toolTip
7980
anchors {fill: parent; margins: 5}
80-
wrapMode: Text.WrapAnywhere
81+
wrapMode: Text.Wrap
82+
width: Math.min(toolTipMaxWidth, (toolTip.text.length +1) * 8)
8183
}
8284
}
8385

src/webenginewidgets/api/qwebenginepage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ void QWebEnginePagePrivate::setToolTip(const QString &toolTipText)
18871887
}
18881888

18891889
// Update tooltip if text was changed.
1890-
QString wrappedTip = QLatin1String("<p style=\"white-space:pre\">")
1890+
QString wrappedTip = QLatin1String("<p style=\"white-space:pre-wrap\">")
18911891
% toolTipText.toHtmlEscaped().left(MaxTooltipLength)
18921892
% QLatin1String("</p>");
18931893
if (view->toolTip() != wrappedTip)

0 commit comments

Comments
 (0)