diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2017-06-08 15:48:55 +0200 |
---|---|---|
committer | Szabolcs David <davidsz@inf.u-szeged.hu> | 2017-10-05 08:48:51 +0000 |
commit | 4c1cde9a1909162fbddeabd958a5f5acc43c83d6 (patch) | |
tree | 2e0a1c0117f16a7cc0b2c5729e14cf32a7fb0532 /src/webengine | |
parent | 3be9a0591f2cf0dac2efa79ea3f2a606afebb5b4 (diff) |
Implement geometryChangeRequested signal in the Quick API
Chromium includes the size of the frame in the requested geometry,
but QWindow::setGeometry() and the related properties of QML Window
expect a size without frame. This patch
- fixes the geometry handling in Demobrowser example.
- implements a new signal in the QML API which sends both frameless
and extended geometries to the application, because QML doesn't have
capability to determine the size of the frame and handle extended
geometry correctly.
Task-number: QTBUG-51181
Change-Id: I8595593aecca33d7cd46986c7abbad0cc7c18ec2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/api/qquickwebengineview.cpp | 6 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p.h | 1 | ||||
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 2 | ||||
-rw-r--r-- | src/webengine/doc/src/webengineview.qdoc | 22 |
4 files changed, 30 insertions, 1 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index c100c1f20..5e5d91012 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -1185,6 +1185,12 @@ void QQuickWebEngineViewPrivate::renderProcessTerminated( renderProcessExitStatus(terminationStatus)), exitCode); } +void QQuickWebEngineViewPrivate::requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) +{ + Q_Q(QQuickWebEngineView); + Q_EMIT q->geometryChangeRequested(geometry, frameGeometry); +} + void QQuickWebEngineViewPrivate::startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, const QPixmap &pixmap, const QPoint &offset) diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 59636188f..ee7e01f26 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -556,6 +556,7 @@ Q_SIGNALS: Q_REVISION(4) void formValidationMessageRequested(QQuickWebEngineFormValidationMessageRequest *request); Q_REVISION(5) void pdfPrintingFinished(const QString &filePath, bool success); Q_REVISION(7) void quotaPermissionRequested(const QQuickWebEngineQuotaPermissionRequest &request); + Q_REVISION(7) void geometryChangeRequested(const QRect &geometry, const QRect &frameGeometry); #ifdef ENABLE_QML_TESTSUPPORT_API void testSupportChanged(); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 6ba9f62b8..b50a524ef 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -139,7 +139,7 @@ public: void moveValidationMessage(const QRect &anchor) override; virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override; - void requestGeometryChange(const QRect &geometry) override { Q_UNUSED(geometry); } + void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override; void updateScrollPosition(const QPointF &position) override; void updateContentsSize(const QSizeF &size) override; void startDragging(const content::DropData &dropData, Qt::DropActions allowedActions, diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index 4f0c40e0d..20db51793 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -1355,3 +1355,25 @@ \qmlmethod void QuotaPermissionRequest::reject() Rejects a quota permission request. */ + +/*! + \qmlsignal WebEngineView::geometryChangeRequested(rect geometry, rect frameGeometry) + \since QtWebEngine 1.7 + + This signal is emitted whenever the document wants to change the position and size of the + page to \a frameGeometry. This can happen for example through JavaScript. + + While \a frameGeometry includes, \a geometry excludes the size of frame margins. + + \note Geometry related properties of QML Window expect a size excluding the window + decoration. You have to use \a geometry to handle this signal correctly. + + \qml + onGeometryChangeRequested: { + window.x = geometry.x + window.y = geometry.y + window.width = geometry.width + window.height = geometry.height + } + \endqml +*/ |