aboutsummaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/webviewtabbar.cpp11
-rw-r--r--src/widgets/webviewtabbar.h8
2 files changed, 14 insertions, 5 deletions
diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp
index d57e095..4d3a859 100644
--- a/src/widgets/webviewtabbar.cpp
+++ b/src/widgets/webviewtabbar.cpp
@@ -22,7 +22,7 @@
#include "browser.h"
#include <QAction>
-WebViewTabBar::WebViewTabBar(QWebEngineProfile *profile, QWidget *parent) :
+WebViewTabBar::WebViewTabBar(WebEngineProfile *profile, QWidget *parent) :
QTabBar(parent)
{
m_profile = profile;
@@ -96,8 +96,10 @@ int WebViewTabBar::addTab(const QUrl &url)
return QTabBar::addTab("New Tab");
}
-void WebViewTabBar::setProfile(QWebEngineProfile *profile)
+void WebViewTabBar::setProfile(WebEngineProfile *profile)
{
+ Q_ASSERT(profile != nullptr);
+
m_profile = profile;
for(auto view : qAsConst(m_views)) {
QWebEnginePage *page = new QWebEnginePage(profile);
@@ -106,6 +108,11 @@ void WebViewTabBar::setProfile(QWebEngineProfile *profile)
}
}
+WebEngineProfile *WebViewTabBar::profile()
+{
+ return m_profile;
+}
+
WebView *WebViewTabBar::currentView()
{
return m_views.at(currentIndex());
diff --git a/src/widgets/webviewtabbar.h b/src/widgets/webviewtabbar.h
index d1ccf81..31a3ab2 100644
--- a/src/widgets/webviewtabbar.h
+++ b/src/widgets/webviewtabbar.h
@@ -24,16 +24,18 @@
#include <QTabBar>
#include "webengine/webview.h"
#include <QSignalMapper>
+#include "webengine/webengineprofile.h"
class WebViewTabBar : public QTabBar
{
Q_OBJECT
public:
- explicit WebViewTabBar(QWebEngineProfile *profile, QWidget *parent = 0);
+ explicit WebViewTabBar(WebEngineProfile *profile = nullptr, QWidget *parent = 0);
~WebViewTabBar();
- void setProfile(QWebEngineProfile *profile);
+ void setProfile(WebEngineProfile *profile);
+ WebEngineProfile *profile();
QSignalMapper *signalMapper();
WebView *currentView();
@@ -62,7 +64,7 @@ private:
QVector<WebView*> m_views;
QSignalMapper *m_signalMapper;
- QWebEngineProfile *m_profile;
+ WebEngineProfile *m_profile = nullptr;
};
#endif // WEBVIEWTABBAR_H