diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-01-16 18:20:32 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-15 17:03:28 +0200 |
commit | beb4ff332ca5b8406a75e8b2146464c5b0a81abd (patch) | |
tree | cb949f8710876153acaa146eda29abf89447a9f4 /examples/webenginewidgets/browser/webview.cpp | |
parent | 84ced937a0f9f2874e32e16c4c6ebf72b46904c9 (diff) |
Cleanup the QtWebEngineWidgets public headers and API
Headers were left intact to leave a trace of the evolution compared
to the QtWebKit API and to make it easier to work until we had a
basic subset of the API implemented.
With the upcoming release, this patch removes this convenience in the
aim of starting polishing the headers and the documentation for the
upcoming release.
Change-Id: Iae436b4ec041d771a7002575e122835802bc9f3e
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'examples/webenginewidgets/browser/webview.cpp')
-rw-r--r-- | examples/webenginewidgets/browser/webview.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/examples/webenginewidgets/browser/webview.cpp b/examples/webenginewidgets/browser/webview.cpp index 6fdf316bd..bc2a4d906 100644 --- a/examples/webenginewidgets/browser/webview.cpp +++ b/examples/webenginewidgets/browser/webview.cpp @@ -55,7 +55,9 @@ #include <QtWidgets/QMessageBox> #include <QtGui/QMouseEvent> +#if defined(QWEBENGINEPAGE_HITTESTCONTENT) #include <QWebEngineHitTestResult> +#endif #ifndef QT_NO_UITOOLS #include <QtUiTools/QUiLoader> @@ -73,8 +75,10 @@ WebPage::WebPage(QObject *parent) #if defined(QWEBENGINEPAGE_SETNETWORKACCESSMANAGER) setNetworkAccessManager(BrowserApplication::networkAccessManager()); #endif +#if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*))); +#endif connect(this, SIGNAL(authenticationRequired(const QUrl &, QAuthenticator*)), SLOT(authenticationRequired(const QUrl &, QAuthenticator*))); connect(this, SIGNAL(proxyAuthenticationRequired(const QUrl &, QAuthenticator *, const QString &)), @@ -92,9 +96,9 @@ BrowserMainWindow *WebPage::mainWindow() return BrowserApplication::instance()->mainWindow(); } +#if defined(QWEBENGINEPAGE_ACCEPTNAVIGATIONREQUEST) bool WebPage::acceptNavigationRequest(QWebEngineFrame *frame, const QNetworkRequest &request, NavigationType type) { -#if defined(QWEBENGINEPAGE_ACCEPTNAVIGATIONREQUEST) // ctrl open in new tab // ctrl-shift open in new tab and select // ctrl-alt open in new window @@ -121,9 +125,8 @@ bool WebPage::acceptNavigationRequest(QWebEngineFrame *frame, const QNetworkRequ } m_loadingUrl = request.url(); emit loadingUrl(m_loadingUrl); -#endif - return QWebEnginePage::acceptNavigationRequest(frame, request, type); } +#endif class PopupWindow : public QWidget { Q_OBJECT @@ -201,9 +204,9 @@ QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QS } #endif // !defined(QT_NO_UITOOLS) +#if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) void WebPage::handleUnsupportedContent(QNetworkReply *reply) { -#if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) QString errorString = reply->errorString(); if (m_loadingUrl != reply->url()) { @@ -252,8 +255,8 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) if (m_loadingUrl == reply->url()) { mainFrame()->setHtml(html, reply->url()); } -#endif } +#endif void WebPage::authenticationRequired(const QUrl &requestUrl, QAuthenticator *auth) { @@ -309,16 +312,20 @@ WebView::WebView(QWidget* parent) , m_page(new WebPage(this)) { setPage(m_page); +#if defined(QWEBENGINEPAGE_STATUSBARMESSAGE) connect(page(), SIGNAL(statusBarMessage(QString)), SLOT(setStatusBarText(QString))); +#endif connect(this, SIGNAL(loadProgress(int)), this, SLOT(setProgress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished())); connect(page(), SIGNAL(loadingUrl(QUrl)), this, SIGNAL(urlChanged(QUrl))); +#if defined(QWEBENGINEPAGE_DOWNLOADREQUESTED) connect(page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequested(QNetworkRequest))); +#endif #if defined(QWEBENGINEPAGE_UNSUPPORTEDCONTENT) page()->setForwardUnsupportedContent(true); #endif @@ -363,8 +370,10 @@ void WebView::wheelEvent(QWheelEvent *event) void WebView::openLinkInNewTab() { +#if defined(QWEBENGINEPAGE_WEBACTION_OPENLINKINNEWWINDOW) m_page->m_openInNewTab = true; pageAction(QWebEnginePage::OpenLinkInNewWindow)->trigger(); +#endif } void WebView::setProgress(int progress) |