aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 851ee9e..861f7cf 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -35,7 +35,7 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) :
ui(new Ui::MainWindow),
navigationToolBar(new QToolBar(tr("Navigation"), this)),
tabToolBar(new QToolBar(tr("Tab bar"), this)),
- tabBar(new WebViewTabBar(this)),
+ tabBar(new WebViewTabBar(nullptr, this)),
urlLineEdit(new UrlLineEdit(navigationToolBar)),
progressBar(new LoadingBar(this))
{
@@ -91,6 +91,7 @@ MainWindow::MainWindow(QUrl defaultUrl, QWidget *parent) :
// Load profile
m_profile = qApp->profile(sSettings->value("browser.profile.default").toString());
+ tabBar->setProfile(m_profile);
// loading bar
ui->statusBar->addPermanentWidget(progressBar);
@@ -148,9 +149,9 @@ void MainWindow::addTabbedDock(Qt::DockWidgetArea area, QDockWidget *widget)
void MainWindow::newTab(const QUrl &url)
{
if(!url.isEmpty()) {
- tabBar->addTab(m_profile, url);
+ tabBar->addTab(url);
} else {
- tabBar->addTab(m_profile, sSettings->value("general.newtab").toUrl());
+ tabBar->addTab(sSettings->value("general.newtab").toUrl());
}
}
@@ -202,11 +203,14 @@ void MainWindow::handleTabChanged(WebView *view)
{
Q_ASSERT(view);
- // clear the parent of the central widget so it doesn't get deleted
- centralWidget()->setParent(0);
+ // centralWidget can be a nullptr
+ if(centralWidget()) {
+ // clear the parent of the central widget so it doesn't get deleted
+ centralWidget()->setParent(0);
- // disconnect signals
- disconnect(centralWidget());
+ // disconnect signals
+ disconnect(centralWidget());
+ }
// set new central widget
setCentralWidget(view);