summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTamas Zakor <ztamas@inf.u-szeged.hu>2019-07-11 10:44:05 +0200
committerTamas Zakor <ztamas@inf.u-szeged.hu>2019-07-25 10:19:25 +0200
commitc3c37b4e93a26748497bec1a0dc29b8358408157 (patch)
treed9a15d91ac9fe360af9cc6a09644e6b651a8ecf9
parent9dce1c5b12db094cdc469d7d68eb3124f9393dc7 (diff)
Fix tooltip text wrapping
Also set the hiding delay to a reasonable time. Fixes: QTBUG-76122 Change-Id: Id971edbd9fb87cc96df53f73f2e7c61bde5855ef Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/webengine/ui/ToolTip.qml8
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/webengine/ui/ToolTip.qml b/src/webengine/ui/ToolTip.qml
index 96033e8f..2bfe9eaf 100644
--- a/src/webengine/ui/ToolTip.qml
+++ b/src/webengine/ui/ToolTip.qml
@@ -47,8 +47,9 @@ Item {
visible: false
property alias text: toolTip.text
- property int delayTimerInterval: 1000
- property int hideTimerInterval: 1500
+ property int delayTimerInterval: 500
+ property int hideTimerInterval: 10000
+ property int toolTipMaxWidth: 400
Timer {
id: delayTimer
@@ -77,7 +78,8 @@ Item {
Text {
id: toolTip
anchors {fill: parent; margins: 5}
- wrapMode: Text.WrapAnywhere
+ wrapMode: Text.Wrap
+ width: Math.min(toolTipMaxWidth, (toolTip.text.length +1) * 8)
}
}
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 05504734..35fe542e 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -1887,7 +1887,7 @@ void QWebEnginePagePrivate::setToolTip(const QString &toolTipText)
}
// Update tooltip if text was changed.
- QString wrappedTip = QLatin1String("<p style=\"white-space:pre\">")
+ QString wrappedTip = QLatin1String("<p style=\"white-space:pre-wrap\">")
% toolTipText.toHtmlEscaped().left(MaxTooltipLength)
% QLatin1String("</p>");
if (view->toolTip() != wrappedTip)