aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/webviewtabbar.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-01-13 17:49:52 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-01-13 17:49:52 +0100
commit4823393a8348674999657670076cf73a612cfb4a (patch)
tree973fa57a66ed42e3419453888edff8e054b62a5f /src/widgets/webviewtabbar.cpp
parentAdded all QtWebEngineProfile options to ProfileDialog (diff)
downloadsmolbote-4823393a8348674999657670076cf73a612cfb4a.tar.xz
Swapping profiles now works
Diffstat (limited to 'src/widgets/webviewtabbar.cpp')
-rw-r--r--src/widgets/webviewtabbar.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp
index efc8fef..666c610 100644
--- a/src/widgets/webviewtabbar.cpp
+++ b/src/widgets/webviewtabbar.cpp
@@ -15,9 +15,14 @@ WebViewTabBar::~WebViewTabBar()
m_views.clear();
}
-int WebViewTabBar::addTab(QWebEngineView *view)
+int WebViewTabBar::addTab(QWebEngineProfile *profile, const QUrl &url)
{
+ QWebEngineView *view = new QWebEngineView(0);
+ QWebEnginePage *page = new QWebEnginePage(profile);
+ view->setPage(page);
+ page->load(url);
m_views.append(view);
+
//connect(view, SIGNAL(titleChanged()), this, SLOT(updateTabText()));
connect(view, &QWebEngineView::titleChanged, [this, view](const QString &title) {
int index = m_views.indexOf(view);
@@ -27,9 +32,19 @@ int WebViewTabBar::addTab(QWebEngineView *view)
int index = m_views.indexOf(view);
setTabIcon(index, icon);
});
+
return QTabBar::addTab("New Tab");
}
+void WebViewTabBar::setProfile(QWebEngineProfile *profile)
+{
+ for(QWebEngineView *view : m_views) {
+ QWebEnginePage *page = new QWebEnginePage(profile);
+ page->load(view->url());
+ view->setPage(page);
+ }
+}
+
QWebEngineView *WebViewTabBar::currentView()
{
return m_views.at(currentIndex());