aboutsummaryrefslogtreecommitdiff
path: root/src/subwindow/tabwidget.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-04-29 18:49:07 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-05-08 13:40:29 +0300
commite87693c54ca97ed3a6ed25f9eaae8ab223fc18b1 (patch)
tree54194ca979ac7e646ff3f10ed6d7f7753273f0be /src/subwindow/tabwidget.cpp
parentExpand pluginloader test coverage (diff)
downloadsmolbote-e87693c54ca97ed3a6ed25f9eaae8ab223fc18b1.tar.xz
libwebengine
Make src/webengine into a static library - Add some tests - Updated manpage - Remove WebProfileManager::id and WebProfileManager::instance - Add consumable semantics checks to WebProfileManager - Add WebProfileManager::walk Add ApplicationMenu class
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));
});
}