summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2018-01-02 16:24:05 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2018-01-08 07:52:31 +0000
commit56fd6e23f4900bb712bf3139232eadac5b6b7223 (patch)
treeaa2b12697705231ed0fab7a6fc527ebe1ec4a69b
parent9ef3a8263098c6a32db8b824aabf85587d1f1140 (diff)
Fix backward compatibility
- Guard QTemporaryDir::filePath (5.9) usage in the drag and drop implementation. - Guard QQuickItem::mapToGlobal (5.7) usage in the Quick context menu implementation. Change-Id: If383fa55fbbd1b2a3fe4abd57373598a1703786c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/web_contents_adapter.cpp4
-rw-r--r--src/webengine/ui_delegates_manager.cpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 53bb55b6a..ff4f09f0e 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1267,7 +1267,11 @@ bool WebContentsAdapter::handleDropDataFileContents(const content::DropData &dro
}
const QString &fileName = toQt(dropData.file_description_filename);
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
const QString &filePath = d->dndTmpDir->filePath(fileName);
+#else
+ const QString &filePath = d->dndTmpDir->path() + QLatin1Char('/') + fileName;
+#endif
QFile file(filePath);
if (!file.open(QIODevice::WriteOnly)) {
qWarning("Cannot write temporary file %s.", qUtf8Printable(filePath));
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index c9c013d52..24861fd35 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -504,7 +504,12 @@ public:
if (pos.isNull() || !item->contains(pos))
return;
const QPoint oldPos = QCursor::pos();
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
const QPoint globalPos = item->mapToGlobal(QPointF(pos)).toPoint();
+#else
+ const QPoint posInWindow = item->mapToItem(item->window()->contentItem(), QPointF(pos)).toPoint();
+ const QPoint globalPos = item->window()->mapToGlobal(posInWindow);
+#endif
if (oldPos == globalPos)
return;
m_oldCursorPos = oldPos;