aboutsummaryrefslogtreecommitdiff
path: root/src/subwindow/tabwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/subwindow/tabwidget.cpp')
-rw-r--r--src/subwindow/tabwidget.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/subwindow/tabwidget.cpp b/src/subwindow/tabwidget.cpp
index d09fffb..efa2b6a 100644
--- a/src/subwindow/tabwidget.cpp
+++ b/src/subwindow/tabwidget.cpp
@@ -17,17 +17,18 @@
#include <QWebEngineHistory>
#include "subwindow.h"
-inline WebView *createViewFromInfo(TabWidget::TabInformation &tab, QWidget *parent)
+inline WebView *createViewFromInfo(TabWidget::TabInformation &tab, SubWindow *parent)
{
- auto *view = new WebView(tab.profile, parent);
+ auto *view = new WebView(tab.profile, std::bind(&SubWindow::createView, parent, std::placeholders::_1), parent);
QDataStream stream(&tab.historyBuffer, QIODevice::ReadOnly);
stream >> *view->history();
view->history()->goToItem(view->history()->itemAt(tab.historyIndex));
return view;
}
-TabWidget::TabWidget(QWidget *parent)
+TabWidget::TabWidget(SubWindow *parent)
: QTabWidget(parent)
+ , m_parent(parent)
{
setStyleSheet("QTabBar::tab { width: 200px; }");
@@ -132,7 +133,7 @@ int TabWidget::restoreLastTab()
{
if(!m_closedTabs.isEmpty()) {
TabInformation tab = m_closedTabs.takeLast();
- return addTab(createViewFromInfo(tab, this));
+ return addTab(createViewFromInfo(tab, m_parent));
}
return -1;
}
@@ -147,7 +148,7 @@ void TabWidget::restoreTabMenu(QMenu *menu)
connect(openAction, &QAction::triggered, this, [this, i]() {
TabInformation tab = m_closedTabs.takeAt(i);
- addTab(createViewFromInfo(tab, this));
+ addTab(createViewFromInfo(tab, m_parent));
});
}