summaryrefslogtreecommitdiffstats
path: root/src/webengine/ui_delegates_manager.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-05-08 14:44:17 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2017-05-10 04:16:52 +0000
commit637beda0062ff65918823147830b52e29ae550a6 (patch)
treeb7d2ef4aa1c05dc4ba7ba4c0032544090ace638b /src/webengine/ui_delegates_manager.cpp
parent757d5b1cea0d3d70b97b31f331df9ada82f45d2d (diff)
Fix backwards compatibility
QtWebEngine supports building with last stable and last LTS Qt releases. Guard some 5.7-5.9 API from being used when not available, and reinstate the default features for 5.6 LTS builds. Change-Id: Ia288a49109d011a2bee883d4a2d38d994b497d59 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/webengine/ui_delegates_manager.cpp')
-rw-r--r--src/webengine/ui_delegates_manager.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index 4a47a49eb..6cc496d5b 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -50,6 +50,7 @@
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlProperty>
+#include <QQuickWindow>
#include <QCursor>
#include <QList>
#include <QScreen>
@@ -559,7 +560,11 @@ void UIDelegatesManager::showToolTip(const QString &text)
int width = QQmlProperty(m_toolTip.data(), QStringLiteral("width")).read().toInt();
QSize toolTipSize(width, height);
QPoint position = m_view->cursor().pos();
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
position = m_view->mapFromGlobal(calculateToolTipPosition(position, toolTipSize)).toPoint();
+#else
+ position = m_view->window()->mapFromGlobal(calculateToolTipPosition(position, toolTipSize));
+#endif
QQmlProperty(m_toolTip.data(), QStringLiteral("x")).write(position.x());
QQmlProperty(m_toolTip.data(), QStringLiteral("y")).write(position.y());