From f5663edb4e1a53b6d80de909f2888ffd9ee1e170 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 7 Jul 2017 15:21:28 +0200 Subject: FIRST!!!1 --- src/webview.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/webview.cpp (limited to 'src/webview.cpp') diff --git a/src/webview.cpp b/src/webview.cpp new file mode 100644 index 0000000..aa9c650 --- /dev/null +++ b/src/webview.cpp @@ -0,0 +1,18 @@ +#include "webview.h" +#include + +void WebView::windowCloseRequested() +{ + // If we have an old URL stored on the stack, navigate back to it, otherwise we return and nothing happens + if (_urls.empty()) + return; + QUrl url = _urls.pop(); + page()->mainFrame()->load(url); +} + +QWebView* WebView::createWindow(QWebPage::WebWindowType) +{ + // Remember current URL, then return the current Web View so no new window opens + _urls.push(this->url()); + return this; +} -- cgit v1.2.3-55-g7522