From 3398abfc1b5b789d11592aada0b5860e36a50041 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 31 Mar 2016 17:36:22 +0200 Subject: 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 --- src/webenginewidgets/api/qwebenginepage.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/webenginewidgets/api/qwebenginepage.cpp') 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 @@ -715,6 +715,29 @@ void QWebEnginePage::setBackgroundColor(const QColor &color) d->adapter->backgroundColorChanged(); } +/*! + * 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. -- cgit v1.2.3