diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2016-03-31 17:36:22 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2016-06-16 15:53:32 +0000 |
commit | 3398abfc1b5b789d11592aada0b5860e36a50041 (patch) | |
tree | 0c18602e09e9f3a250d8de6fa8618e2895aa07dc /src/webenginewidgets/api/qwebenginepage.cpp | |
parent | 939d104cc5a8208a0bef94ca14889ccd584a3526 (diff) |
Introduce QWebEnginePage::save
Add the convenience method QWebEnginePage::save for saving pages without
the need to explicitly handle download requests.
Task-number: QTBUG-51798
Change-Id: I8910ce8cb7c9370d72f2b209c4d2de07c614f6d6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r-- | src/webenginewidgets/api/qwebenginepage.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 3f11e5aef..8a9f04860 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -716,6 +716,29 @@ void QWebEnginePage::setBackgroundColor(const QColor &color) } /*! + * Save the currently loaded web page to disk. + * + * The web page is saved to \a filePath in the specified \a{format}. + * + * This is a short cut for the following actions: + * \list + * \li Trigger the Save web action. + * \li Accept the next download item and set the specified file path and save format. + * \endlist + * + * This function issues an asynchronous download request for the web page and returns immediately. + * + * \sa QWebEngineDownloadItem::SavePageFormat + * \since 5.8 + */ +void QWebEnginePage::save(const QString &filePath, + QWebEngineDownloadItem::SavePageFormat format) const +{ + Q_D(const QWebEnginePage); + d->adapter->save(filePath, format); +} + +/*! \property QWebEnginePage::audioMuted \brief whether the current page audio is muted. \since 5.7 |