summaryrefslogtreecommitdiff
path: root/src/webenginewidgets/api/qwebenginepage.cpp
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2017-06-27 16:56:59 +0200
committerFlorian Bruhin <qt-project.org@the-compiler.org>2017-07-19 15:07:52 +0000
commit0f20780db00950f48899b698d05a33c45f3e1d14 (patch)
treef4cef3322549bf9b1c89dea68fb2e672a57a262a /src/webenginewidgets/api/qwebenginepage.cpp
parent0feb0436f5d9a1adc401de837e25e523a03d2925 (diff)
downloadqtwebengine-0f20780db00950f48899b698d05a33c45f3e1d14.tar.gz
Add method for triggering downloads
The method download(const QUrl &url, const QString &suggestedFileName) already exists in WebContentsAdapter. It is now accessible through a corresponding method in QWebEnginePage. [ChangeLog][QtWebEngineWidgets][QWebEnginePage] New QWebEnginePage::download() method to start custom downloads for a web page. Task-number: QTBUG-55944 Change-Id: I185ec69c1668b377a129bc9fc09963278e52de1e Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 5b7fa9df2..34728834e 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -1810,6 +1810,25 @@ WebEngineSettings *QWebEnginePagePrivate::webEngineSettings() const
return settings->d_func();
}
+/*!
+ \since 5.10
+ Downloads the resource from the location given by \a url to a local file.
+
+ If \a filename is given, it is used as the suggested file name.
+ If it is relative, the file is saved in the standard download location with
+ the given name.
+ If it is a null or empty QString, the default file name is used.
+
+ This will emit QWebEngineProfile::downloadRequested() after the download
+ has started.
+*/
+
+void QWebEnginePage::download(const QUrl& url, const QString& filename)
+{
+ Q_D(QWebEnginePage);
+ d->adapter->download(url, filename);
+}
+
void QWebEnginePage::load(const QUrl& url)
{
Q_D(QWebEnginePage);