82 lines
3.6 KiB
Diff
82 lines
3.6 KiB
Diff
|
From 84363df1cb1891d532c010fa5ac3d3ec56045428 Mon Sep 17 00:00:00 2001
|
||
|
From: Christophe Chapuis <chris.chapuis@gmail.com>
|
||
|
Date: Wed, 28 Oct 2015 20:17:02 +0100
|
||
|
Subject: [PATCH 10/18] WebEngineNewViewRequest: add possibility to get
|
||
|
requested window geometry
|
||
|
|
||
|
Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>
|
||
|
---
|
||
|
src/webengine/api/qquickwebenginenewviewrequest.cpp | 5 +++++
|
||
|
src/webengine/api/qquickwebenginenewviewrequest_p.h | 3 +++
|
||
|
src/webengine/api/qquickwebengineview.cpp | 3 ++-
|
||
|
3 files changed, 10 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp
|
||
|
index 2272aa1..394064d 100644
|
||
|
--- a/src/webengine/api/qquickwebenginenewviewrequest.cpp
|
||
|
+++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp
|
||
|
@@ -105,6 +105,11 @@ QUrl QQuickWebEngineNewViewRequest::url() const
|
||
|
return QUrl();
|
||
|
}
|
||
|
|
||
|
+QRect QQuickWebEngineNewViewRequest::requestedGeometry() const
|
||
|
+{
|
||
|
+ return m_requestedGeometry;
|
||
|
+}
|
||
|
+
|
||
|
/*!
|
||
|
\qmlmethod WebEngineNewViewRequest::openIn(WebEngineView view)
|
||
|
|
||
|
diff --git a/src/webengine/api/qquickwebenginenewviewrequest_p.h b/src/webengine/api/qquickwebenginenewviewrequest_p.h
|
||
|
index 591e983..68f9255 100644
|
||
|
--- a/src/webengine/api/qquickwebenginenewviewrequest_p.h
|
||
|
+++ b/src/webengine/api/qquickwebenginenewviewrequest_p.h
|
||
|
@@ -69,6 +69,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineNewViewRequest : public QObject
|
||
|
Q_PROPERTY(bool userInitiated READ isUserInitiated CONSTANT FINAL)
|
||
|
Q_PROPERTY(QStringList additionalFeatures READ additionalFeatures CONSTANT FINAL)
|
||
|
Q_PROPERTY(QUrl url READ url)
|
||
|
+ Q_PROPERTY(QRect requestedGeometry READ requestedGeometry CONSTANT FINAL)
|
||
|
public:
|
||
|
~QQuickWebEngineNewViewRequest();
|
||
|
|
||
|
@@ -78,6 +79,7 @@ public:
|
||
|
const QStringList &additionalFeatures() const;
|
||
|
Q_INVOKABLE void openIn(QQuickWebEngineView *view);
|
||
|
QUrl url() const;
|
||
|
+ QRect requestedGeometry() const;
|
||
|
|
||
|
private:
|
||
|
QQuickWebEngineNewViewRequest();
|
||
|
@@ -86,6 +88,7 @@ private:
|
||
|
QSharedPointer<QtWebEngineCore::WebContentsAdapter> m_adapter;
|
||
|
QUrl m_requestedUrl;
|
||
|
friend class QQuickWebEngineView;
|
||
|
+ QRect m_requestedGeometry;
|
||
|
QStringList m_additionalFeatures;
|
||
|
friend class QQuickWebEngineViewPrivate;
|
||
|
};
|
||
|
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
|
||
|
index c8e9e51..2805240 100644
|
||
|
--- a/src/webengine/api/qquickwebengineview.cpp
|
||
|
+++ b/src/webengine/api/qquickwebengineview.cpp
|
||
|
@@ -588,7 +588,7 @@ void QQuickWebEngineViewPrivate::unhandledKeyEvent(QKeyEvent *event)
|
||
|
q->window()->sendEvent(q->parentItem(), event);
|
||
|
}
|
||
|
|
||
|
-void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &, const QUrl &targetUrl, const QStringList &additionalFeaturesStringList)
|
||
|
+void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &requestedGeometry, const QStringList &additionalFeaturesStringList)
|
||
|
{
|
||
|
Q_Q(QQuickWebEngineView);
|
||
|
QQuickWebEngineNewViewRequest request;
|
||
|
@@ -598,6 +598,7 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapte
|
||
|
request.m_isUserInitiated = userGesture;
|
||
|
request.m_requestedUrl = targetUrl;
|
||
|
request.m_additionalFeatures = additionalFeaturesStringList;
|
||
|
+ request.m_requestedGeometry = requestedGeometry;
|
||
|
|
||
|
switch (disposition) {
|
||
|
case WebContentsAdapterClient::NewForegroundTabDisposition:
|
||
|
--
|
||
|
2.7.4
|
||
|
|