summaryrefslogtreecommitdiffstats
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2017-07-07 15:21:28 +0200
committerSimon Rettberg2017-07-07 15:21:28 +0200
commitf5663edb4e1a53b6d80de909f2888ffd9ee1e170 (patch)
treef776b8e929bc356c215fafc46e6548ffe957e7f9 /src/webview.cpp
downloadslxbrowser-f5663edb4e1a53b6d80de909f2888ffd9ee1e170.tar.gz
slxbrowser-f5663edb4e1a53b6d80de909f2888ffd9ee1e170.tar.xz
slxbrowser-f5663edb4e1a53b6d80de909f2888ffd9ee1e170.zip
FIRST!!!1
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp18
1 files changed, 18 insertions, 0 deletions
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 <QWebFrame>
+
+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;
+}