From 19ff096cd450780f16bfe8f699e76f6dc68fe193 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Tue, 1 May 2018 18:38:54 +0200 Subject: Don't open additional tabs when creating subwindows --- src/mainwindow/window.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mainwindow/window.cpp') diff --git a/src/mainwindow/window.cpp b/src/mainwindow/window.cpp index fb4eb07..055d945 100644 --- a/src/mainwindow/window.cpp +++ b/src/mainwindow/window.cpp @@ -152,6 +152,15 @@ void Window::restoreSession(const QJsonObject &sessionData) Q_ASSERT_X(sessionData.value("tabs") != QJsonValue::Undefined, "Window::restoreSession", "no tabs in json"); const QJsonArray tabs = sessionData.value("tabs").toArray(); + + if(tabs.count() == 0) { + // open a newtab + auto *view = new WebView(profile, this); + view->load(profile->newtab()); + tabWidget->addTab(view); + return; + } + for(const auto tab : tabs) { auto *view = new WebView(profile, this); view->load(QUrl::fromUserInput(tab.toString())); -- cgit v1.2.1