diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-07-13 12:34:48 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-19 21:53:10 +0000 |
commit | a18bd92cd95d482792aacd4d164d066122ac14c6 (patch) | |
tree | 62eaf9323d7d42e7f57dd5bc92bc1b528764c30d /src | |
parent | adc3ebe1fb26df925a15c63cc59c0910cf63d535 (diff) |
Rename quick's 'newViewRequested' to 'newWindowRequested'
Match new api within the page API.
Change-Id: Ib2af2f5270f368813cecab8f1c6b7366d3b7172f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 339017523ed418a9dc48d9343e5dc63eb1f29ec1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/api/qwebenginenewwindowrequest.cpp | 28 | ||||
-rw-r--r-- | src/webenginequick/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebenginenewwindowrequest.cpp (renamed from src/webenginequick/api/qquickwebenginenewviewrequest.cpp) | 14 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebenginenewwindowrequest_p.h (renamed from src/webenginequick/api/qquickwebenginenewviewrequest_p.h) | 6 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebengineview.cpp | 20 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebengineview_p.h | 6 | ||||
-rw-r--r-- | src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml | 4 | ||||
-rw-r--r-- | src/webenginequick/doc/src/webengineview_lgpl.qdoc | 24 |
8 files changed, 52 insertions, 52 deletions
diff --git a/src/core/api/qwebenginenewwindowrequest.cpp b/src/core/api/qwebenginenewwindowrequest.cpp index 9fc025c0e..2048dea73 100644 --- a/src/core/api/qwebenginenewwindowrequest.cpp +++ b/src/core/api/qwebenginenewwindowrequest.cpp @@ -59,16 +59,16 @@ QT_BEGIN_NAMESPACE */ /*! - \qmltype WebEngineNewViewRequest - \instantiates QWebEngineNewWindowRequest + \qmltype WebEngineNewWindowRequest + \instantiates QQuickWebEngineNewWindowRequest \inqmlmodule QtWebEngineQuick - \since QtWebEngine 1.1 + \since QtWebEngine 1.12 - \brief A utility type for the WebEngineView::newViewRequested signal. + \brief A utility type for the WebEngineView::newWindowRequested signal. Contains information about a request to load a page in a separate web engine view. - \sa WebEngineView::newViewRequested + \sa WebEngineView::newWindowRequested */ /*! @@ -87,17 +87,17 @@ QT_BEGIN_NAMESPACE */ /*! - \qmlproperty enumeration WebEngineNewViewRequest::DestinationType + \qmlproperty enumeration WebEngineNewWindowRequest::DestinationType Describes how to open a new view: - \value WebEngineNewViewRequest.InNewWindow + \value WebEngineNewWindowRequest.InNewWindow In a separate window. - \value WebEngineNewViewRequest.InNewTab + \value WebEngineNewWindowRequest.InNewTab In a tab of the same window. - \value WebEngineNewViewRequest.InNewDialog + \value WebEngineNewWindowRequest.InNewDialog In a window without a tab bar, toolbar, or URL bar. - \value WebEngineNewViewRequest.InNewBackgroundTab + \value WebEngineNewWindowRequest.InNewBackgroundTab In a tab of the same window, without hiding the currently visible web engine view. */ @@ -121,7 +121,7 @@ QWebEngineNewWindowRequest::~QWebEngineNewWindowRequest() \brief The type of window that is requested. */ /*! - \qmlproperty WebEngineNewViewRequest::DestinationType WebEngineNewViewRequest::destination + \qmlproperty WebEngineNewWindowRequest::DestinationType WebEngineNewWindowRequest::destination \brief The type of window that is requested. */ QWebEngineNewWindowRequest::DestinationType QWebEngineNewWindowRequest::destination() const @@ -134,7 +134,7 @@ QWebEngineNewWindowRequest::DestinationType QWebEngineNewWindowRequest::destinat \brief The URL that is requested for the new page. */ /*! - \qmlproperty QUrl WebEngineNewViewRequest::requestedUrl + \qmlproperty QUrl WebEngineNewWindowRequest::requestedUrl \brief The URL that is requested for the new page. \since QtWebEngine 1.5 */ @@ -148,7 +148,7 @@ QUrl QWebEngineNewWindowRequest::requestedUrl() const \brief The size that is requested for the new page. */ /*! - \qmlproperty QRect WebEngineNewViewRequest::requestedGeometry + \qmlproperty QRect WebEngineNewWindowRequest::requestedGeometry \brief The size that is requested for the new page. \since QtWebEngine 2.0 */ @@ -164,7 +164,7 @@ QRect QWebEngineNewWindowRequest::requestedGeometry() const You can use this property to block automatic \e popups. */ /*! - \qmlproperty bool WebEngineNewViewRequest::userInitiated + \qmlproperty bool WebEngineNewWindowRequest::userInitiated Whether this window request was directly triggered as the result of a keyboard or mouse event. You can use this property to block automatic \e popups. diff --git a/src/webenginequick/CMakeLists.txt b/src/webenginequick/CMakeLists.txt index 7fd84c0a4..ac9c905e2 100644 --- a/src/webenginequick/CMakeLists.txt +++ b/src/webenginequick/CMakeLists.txt @@ -21,7 +21,7 @@ qt_internal_add_qml_module(WebEngineQuick api/qquickwebenginedownloadrequest.cpp api/qquickwebenginedownloadrequest_p.h api/qquickwebenginefaviconprovider.cpp api/qquickwebenginefaviconprovider_p_p.h - api/qquickwebenginenewviewrequest.cpp api/qquickwebenginenewviewrequest_p.h + api/qquickwebenginenewwindowrequest.cpp api/qquickwebenginenewwindowrequest_p.h api/qquickwebengineprofile.cpp api/qquickwebengineprofile.h api/qquickwebengineprofile_p.h api/qquickwebenginescriptcollection.cpp api/qquickwebenginescriptcollection_p.h api/qquickwebenginesettings.cpp api/qquickwebenginesettings_p.h diff --git a/src/webenginequick/api/qquickwebenginenewviewrequest.cpp b/src/webenginequick/api/qquickwebenginenewwindowrequest.cpp index e2e20f35e..fb36babfa 100644 --- a/src/webenginequick/api/qquickwebenginenewviewrequest.cpp +++ b/src/webenginequick/api/qquickwebenginenewwindowrequest.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qquickwebenginenewviewrequest_p.h" +#include "qquickwebenginenewwindowrequest_p.h" #include "qquickwebengineview_p.h" #include "web_contents_adapter_client.h" @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ -QQuickWebEngineNewViewRequest::QQuickWebEngineNewViewRequest(DestinationType dest, const QRect &rect, const QUrl &url, +QQuickWebEngineNewWindowRequest::QQuickWebEngineNewWindowRequest(DestinationType dest, const QRect &rect, const QUrl &url, bool user, QSharedPointer<QtWebEngineCore::WebContentsAdapter> adapter, QObject *parent) @@ -56,22 +56,22 @@ QQuickWebEngineNewViewRequest::QQuickWebEngineNewViewRequest(DestinationType des } /*! - \qmlmethod WebEngineNewViewRequest::openIn(WebEngineView view) + \qmlmethod WebEngineNewWindowRequest::openIn(WebEngineView view) Opens the requested page in the new web engine view \a view. State and history of the view and the page possibly loaded in it will be lost. - \sa WebEngineView::newViewRequested + \sa WebEngineView::newWindowRequested */ /*! \internal */ -void QQuickWebEngineNewViewRequest::openIn(QQuickWebEngineView *view) +void QQuickWebEngineNewWindowRequest::openIn(QQuickWebEngineView *view) { if (!view) { - qWarning("Trying to open a WebEngineNewViewRequest in an invalid WebEngineView."); + qWarning("Trying to open a WebEngineNewWindowRequest in an invalid WebEngineView."); return; } - view->acceptAsNewView(this); + view->acceptAsNewWindow(this); } QT_END_NAMESPACE diff --git a/src/webenginequick/api/qquickwebenginenewviewrequest_p.h b/src/webenginequick/api/qquickwebenginenewwindowrequest_p.h index 4849bc6b8..df5e7234b 100644 --- a/src/webenginequick/api/qquickwebenginenewviewrequest_p.h +++ b/src/webenginequick/api/qquickwebenginenewwindowrequest_p.h @@ -59,11 +59,11 @@ QT_BEGIN_NAMESPACE class QQuickWebEngineView; -class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineNewViewRequest : public QWebEngineNewWindowRequest +class Q_WEBENGINEQUICK_PRIVATE_EXPORT QQuickWebEngineNewWindowRequest : public QWebEngineNewWindowRequest { Q_OBJECT public: - QML_NAMED_ELEMENT(WebEngineNewViewRequest) + QML_NAMED_ELEMENT(WebEngineNewWindowRequest) QML_ADDED_IN_VERSION(1, 1) QML_EXTRA_VERSION(2, 0) QML_UNCREATABLE("") @@ -71,7 +71,7 @@ public: Q_INVOKABLE void openIn(QQuickWebEngineView *); private: - QQuickWebEngineNewViewRequest(DestinationType, const QRect &, const QUrl &, bool, + QQuickWebEngineNewWindowRequest(DestinationType, const QRect &, const QUrl &, bool, QSharedPointer<QtWebEngineCore::WebContentsAdapter>, QObject * = nullptr); diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp index 22dea9121..562814128 100644 --- a/src/webenginequick/api/qquickwebengineview.cpp +++ b/src/webenginequick/api/qquickwebengineview.cpp @@ -42,7 +42,7 @@ #include "qquickwebengineclientcertificateselection_p.h" #include "qquickwebenginedialogrequests_p.h" #include "qquickwebenginefaviconprovider_p_p.h" -#include "qquickwebenginenewviewrequest_p.h" +#include "qquickwebenginenewwindowrequest_p.h" #include "qquickwebengineprofile.h" #include "qquickwebengineprofile_p.h" #include "qquickwebenginescriptcollection_p.h" @@ -496,10 +496,10 @@ QQuickWebEngineViewPrivate::adoptNewWindow(QSharedPointer<WebContentsAdapter> ne { Q_Q(QQuickWebEngineView); Q_ASSERT(newWebContents); - QQuickWebEngineNewViewRequest request(toDestinationType(disposition), geometry, + QQuickWebEngineNewWindowRequest request(toDestinationType(disposition), geometry, targetUrl, userGesture, newWebContents); - Q_EMIT q->newViewRequested(&request); + Q_EMIT q->newWindowRequested(&request); if (request.d_ptr->isRequestHandled) return newWebContents; @@ -758,7 +758,7 @@ void QQuickWebEngineViewPrivate::adoptWebContents(WebContentsAdapter *webContent { if (!webContents) { qWarning("Trying to open an empty request, it was either already used or was invalidated." - "\nYou must complete the request synchronously within the newViewRequested signal handler." + "\nYou must complete the request synchronously within the newWindowRequested signal handler." " If a view hasn't been adopted before returning, the request will be invalidated."); return; } @@ -1622,13 +1622,13 @@ void QQuickWebEngineView::itemChange(ItemChange change, const ItemChangeData &va QQuickItem::itemChange(change, value); } -void QQuickWebEngineView::acceptAsNewView(QWebEngineNewWindowRequest *request) +void QQuickWebEngineView::acceptAsNewWindow(QWebEngineNewWindowRequest *request) { Q_D(QQuickWebEngineView); if (!request || (!request->d_ptr->adapter && !request->requestedUrl().isValid()) || request->d_ptr->isRequestHandled) { qWarning("Trying to open an empty request, it was either already used or was invalidated." - "\nYou must complete the request synchronously within the newViewRequested signal handler." + "\nYou must complete the request synchronously within the newWindowRequested signal handler." " If a view hasn't been adopted before returning, the request will be invalidated."); return; } @@ -1730,16 +1730,16 @@ void QQuickWebEngineView::triggerWebAction(WebAction action) break; case OpenLinkInNewWindow: if (d->m_contextMenuRequest->filteredLinkUrl().isValid()) { - QQuickWebEngineNewViewRequest request(QWebEngineNewWindowRequest::InNewWindow, QRect(), + QQuickWebEngineNewWindowRequest request(QWebEngineNewWindowRequest::InNewWindow, QRect(), d->m_contextMenuRequest->filteredLinkUrl(), true, nullptr); - Q_EMIT newViewRequested(&request); + Q_EMIT newWindowRequested(&request); } break; case OpenLinkInNewTab: if (d->m_contextMenuRequest->filteredLinkUrl().isValid()) { - QQuickWebEngineNewViewRequest request(QWebEngineNewWindowRequest::InNewBackgroundTab, QRect(), + QQuickWebEngineNewWindowRequest request(QWebEngineNewWindowRequest::InNewBackgroundTab, QRect(), d->m_contextMenuRequest->filteredLinkUrl(), true, nullptr); - Q_EMIT newViewRequested(&request); + Q_EMIT newWindowRequested(&request); } break; case CopyLinkToClipboard: diff --git a/src/webenginequick/api/qquickwebengineview_p.h b/src/webenginequick/api/qquickwebengineview_p.h index ab891f4e2..22617dd7b 100644 --- a/src/webenginequick/api/qquickwebengineview_p.h +++ b/src/webenginequick/api/qquickwebengineview_p.h @@ -71,7 +71,7 @@ class QQuickWebEngineClientCertificateSelection; class QQuickWebEngineColorDialogRequest; class QQuickWebEngineFileDialogRequest; class QQuickWebEngineJavaScriptDialogRequest; -class QQuickWebEngineNewViewRequest; +class QQuickWebEngineNewWindowRequest; class QQuickWebEngineProfile; class QQuickWebEngineSettings; class QQuickWebEngineTooltipRequest; @@ -444,7 +444,7 @@ public: void setWebChannelWorld(uint); Q_REVISION(1,8) Q_INVOKABLE QQuickWebEngineAction *action(WebAction action); - Q_INVOKABLE void acceptAsNewView(QWebEngineNewWindowRequest *request); + Q_INVOKABLE void acceptAsNewWindow(QWebEngineNewWindowRequest *request); bool isAudioMuted() const; void setAudioMuted(bool muted); @@ -499,7 +499,6 @@ Q_SIGNALS: Q_REVISION(1,1) void fullScreenRequested(const QWebEngineFullScreenRequest &request); Q_REVISION(1,1) void isFullScreenChanged(); Q_REVISION(1,1) void featurePermissionRequested(const QUrl &securityOrigin, Feature feature); - Q_REVISION(1,1) void newViewRequested(QQuickWebEngineNewViewRequest *request); Q_REVISION(1,1) void zoomFactorChanged(qreal arg); Q_REVISION(1,1) void profileChanged(); Q_REVISION(1,1) void webChannelChanged(); @@ -532,6 +531,7 @@ Q_SIGNALS: Q_REVISION(1,11) void renderProcessPidChanged(qint64 pid); Q_REVISION(1,11) void canGoBackChanged(); Q_REVISION(1,11) void canGoForwardChanged(); + Q_REVISION(1,12) void newWindowRequested(QQuickWebEngineNewWindowRequest *request); protected: void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override; diff --git a/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml b/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml index 70afea2b9..0297a62fd 100644 --- a/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml +++ b/src/webenginequick/doc/snippets/qtwebengine_webengineview_newviewrequested.qml @@ -74,9 +74,9 @@ QtObject { // Handle the signal. Dynamically create the window and // use its WebEngineView as the destination of our request. - onNewViewRequested: function(request) { + onNewWindowRequested: function(request) { var newWindow = windowComponent.createObject(windowParent); - newWindow.webView.acceptAsNewView(request); + newWindow.webView.acceptAsNewWindow(request); } } } diff --git a/src/webenginequick/doc/src/webengineview_lgpl.qdoc b/src/webenginequick/doc/src/webengineview_lgpl.qdoc index 7c13d140a..0d3b66d62 100644 --- a/src/webenginequick/doc/src/webengineview_lgpl.qdoc +++ b/src/webenginequick/doc/src/webengineview_lgpl.qdoc @@ -74,10 +74,10 @@ \section2 Interaction By default, links to different pages load within the same WebEngineView object, but web sites - may request them to be opened as a new tab, window, or dialog. The \l newViewRequested() signal + may request them to be opened as a new tab, window, or dialog. The \l newWindowRequested() signal is emitted when a request to load the page in a separate web engine view is issued. The NewViewDestination property describes how the new view should be opened. In addition, the - WebEngineNewViewRequest utility type can be used to load web pages in separate web engine views. + WebEngineNewWindowRequest utility type can be used to load web pages in separate web engine views. The \l findText() method can be used to search for a string on a web page, using the options described by \l FindFlags. @@ -570,8 +570,8 @@ */ /*! - \qmlsignal WebEngineView::newViewRequested(WebEngineNewViewRequest request) - \since QtWebEngine 1.1 + \qmlsignal WebEngineView::newWindowRequested(WebEngineNewWindowRequest request) + \since QtWebEngine 2.0 This signal is emitted when \a request is issued to load a page in a separate web engine view. This can either be because the current page requested it explicitly @@ -579,23 +579,23 @@ while holding Shift, Ctrl, or a built-in combination that triggers the page to open in a new window. - The signal is handled by calling acceptAsNewView() on the destination view. + The signal is handled by calling acceptAsNewWindow() on the destination view. If this signal is not handled, the requested load will fail. An example implementation: \snippet qtwebengine_webengineview_newviewrequested.qml 0 - \sa WebEngineNewViewRequest, {WebEngine Quick Nano Browser} + \sa WebEngineNewWindowRequest, {WebEngine Quick Nano Browser} */ /*! - \qmlmethod void WebEngineView::acceptAsNewView(QWebEngineNewWindowRequest *request) + \qmlmethod void WebEngineView::acceptAsNewWindow(QWebEngineNewWindowRequest *request) \since QtWebEngine 2.0 - Handle the newViewRequested signal by opening the \a request in this view. + Handle the newWindowRequested signal by opening the \a request in this view. - \sa newViewRequested + \sa newWindowRequested */ /*! @@ -765,10 +765,10 @@ Open the current link in the current window. (Added in Qt 5.6) \value WebEngineView.OpenLinkInNewWindow Open the current link in a new window. Requires a handler for the - \l newViewRequested() signal. (Added in Qt 5.6) + \l newWindowRequested() signal. (Added in Qt 5.6) \value WebEngineView.OpenLinkInNewTab Open the current link in a new tab. Requires a handler for the - \l newViewRequested() signal. (Added in Qt 5.6) + \l newWindowRequested() signal. (Added in Qt 5.6) \value WebEngineView.CopyLinkToClipboard Copy the current link to the clipboard. (Added in Qt 5.6) \value WebEngineView.CopyImageToClipboard @@ -804,7 +804,7 @@ Save the current web page to disk. (Added in Qt 5.7) \value WebEngineView.ViewSource Show the source of the current page in a new tab. Requires a handler for the - \l newViewRequested() signal. (Added in Qt 5.8) + \l newWindowRequested() signal. (Added in Qt 5.8) \value WebEngineView.ToggleBold Toggles boldness for the selection or at the cursor position. |