diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-18 11:39:36 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-22 03:32:24 +0000 |
commit | 3752a3cbcd0cc0742a5b955e925df18395afdb75 (patch) | |
tree | 453369210f11bd672441d11ef4065e79109ac260 /src/core/api/qwebenginedownloadrequest.cpp | |
parent | 15e5ba4bfc920adf56df8dd11cb09ca3a9942963 (diff) |
Add page() and view() back to download-item
Restores a QML type but this time derived from the core type.
Change-Id: I09ddb6672f7262ae31e4c57f09d019f71abccd41
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
(cherry picked from commit b2ecb708e149fe8914d7d0cbfcf9c300e52a029e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/core/api/qwebenginedownloadrequest.cpp')
-rw-r--r-- | src/core/api/qwebenginedownloadrequest.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/api/qwebenginedownloadrequest.cpp b/src/core/api/qwebenginedownloadrequest.cpp index 006fd2e4b..57823a7c9 100644 --- a/src/core/api/qwebenginedownloadrequest.cpp +++ b/src/core/api/qwebenginedownloadrequest.cpp @@ -40,10 +40,13 @@ #include "qwebenginedownloadrequest.h" #include "qwebenginedownloadrequest_p.h" +#include "qwebenginepage.h" + #include "profile_adapter.h" +#include "web_contents_adapter_client.h" #include <QDir> -#include "QFileInfo" +#include <QFileInfo> QT_BEGIN_NAMESPACE @@ -662,14 +665,17 @@ QString QWebEngineDownloadRequest::interruptReasonString() const Returns the page the download was requested on. If the download was not triggered by content in a page, \c nullptr is returned. */ -QObject *QWebEngineDownloadRequest::page() const +QWebEnginePage *QWebEngineDownloadRequest::page() const { Q_D(const QWebEngineDownloadRequest); - //TODO: come back here when page is in core - Q_UNREACHABLE(); + if (d->adapterClient->clientType() == QtWebEngineCore::WebContentsAdapterClient::WidgetsClient) + return const_cast<QWebEnginePage *>(static_cast<const QWebEnginePage *>(d->adapterClient->holdingQObject())); return nullptr; } + +/*! \internal +*/ QWebEngineDownloadRequest::QWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *p, QObject *parent) : QObject(parent) , d_ptr(p) |