diff options
| author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-18 11:39:36 +0200 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-06-21 17:49:31 +0200 |
| commit | b2ecb708e149fe8914d7d0cbfcf9c300e52a029e (patch) | |
| tree | f9fdc60b8e07d19e69c2cd044649f17b491e33f7 /src/core/api/qwebenginedownloadrequest.cpp | |
| parent | 56186b555b98ed682e88c105a16e47023410f58e (diff) | |
Add page() and view() back to download-item
Restores a QML type but this time derived from the core type.
Pick-to: 6.2
Change-Id: I09ddb6672f7262ae31e4c57f09d019f71abccd41
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
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) |
