summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginedownloaditem.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-07-23 17:17:40 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-02 20:52:02 +0000
commit595589197313178551cf7ccd645d2732643875bf (patch)
tree8ed5686b3de206775425eb5c9fcca8dfb3a01320 /src/webenginewidgets/api/qwebenginedownloaditem.cpp
parent1481e8d87fe89d9e27d9de593767b55a0e84a31f (diff)
Add QWebEngineDownloadItem page/view accessor
To be able to determine where a download was triggered. [ChangeLog][DownloadItem] Added a page/view accessor to tell were the download was triggered. Change-Id: I21843a545a3e0eb66f5e5fa8a50e77564f2118a7 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginedownloaditem.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginedownloaditem.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index 631c028c3..fc27e104d 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -169,6 +169,7 @@ QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QWebEngineProfilePr
, downloadPaused(false)
, totalBytes(-1)
, receivedBytes(0)
+ , page(0)
{
}
@@ -630,6 +631,17 @@ QString QWebEngineDownloadItem::interruptReasonString() const
static_cast<ProfileAdapterClient::DownloadInterruptReason>(interruptReason()));
}
+/*!
+ \since 5.12
+ Returns the page the download was requested on. If the download was not triggered by content in a page,
+ \c nullptr is returned.
+*/
+QWebEnginePage *QWebEngineDownloadItem::page() const
+{
+ Q_D(const QWebEngineDownloadItem);
+ return d->page;
+}
+
QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p, QObject *parent)
: QObject(parent)
, d_ptr(p)