aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-09-29 17:38:23 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-09-29 17:38:23 +0200
commit34c06bf75797d94dc411aeaf0f326b135b95fbcf (patch)
treed913c38cabe63d4ad420bd1ad56ded1788c0052f
parentCode cleanup (diff)
downloadsmolbote-34c06bf75797d94dc411aeaf0f326b135b95fbcf.tar.xz
Fixed bug with tab bar not showing up
-rw-r--r--src/mainwindow.cpp14
-rw-r--r--src/mainwindow.h2
-rw-r--r--src/widgets/webviewtabbar.cpp2
3 files changed, 10 insertions, 8 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4146e8a..050384b 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -71,7 +71,7 @@ MainWindow::MainWindow(QWidget *parent) :
// tabToolBar: main menu and tab list
tabToolBar->setMovable(browser->settings()->value("window.ui.tabtoolbarMovable").toBool());
tabToolBar->addWidget(menuBar);
- tabToolBar->addWidget(tabBar);
+ //tabToolBar->addWidget(tabBar);
this->addToolBar(Qt::TopToolBarArea, tabToolBar);
this->addToolBarBreak(Qt::TopToolBarArea);
@@ -79,7 +79,6 @@ MainWindow::MainWindow(QWidget *parent) :
navigationToolBar->setMovable(browser->settings()->value("window.ui.navtoolbarMovable").toBool());
// page actions
-m:
m_backButton = new NavigationButton(NavigationButton::BackButton, this);
m_forwardButton = new NavigationButton(NavigationButton::ForwardButton, this);
@@ -116,6 +115,8 @@ m:
// Load profile
tabBar->setProfile(browser->profile(browser->settings()->value("browser.profile.default").toString()));
+ // Adding a tab here, because otherwise tabs won't show up
+ //newTab();
// loading bar
ui->statusBar->addPermanentWidget(m_progressBar);
@@ -157,11 +158,11 @@ void MainWindow::addTabbedDock(Qt::DockWidgetArea area, QDockWidget *widget)
void MainWindow::newTab(const QUrl &url)
{
- if(!url.isEmpty()) {
- tabBar->addTab(url);
- } else {
- tabBar->addTab(tabBar->profile()->newtab());
+ if(!m_tabBarAdded) {
+ m_tabBarAdded = true;
+ tabToolBar->addWidget(tabBar);
}
+ tabBar->addTab(url);
}
void MainWindow::focusAddress()
@@ -228,7 +229,6 @@ void MainWindow::handleTabChanged(WebView *view)
setCentralWidget(view);
// connect signals
-m:
m_backButton->setView(view);
m_forwardButton->setView(view);
m_reloadButton->setView(view);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 5d330d5..5537900 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -78,6 +78,8 @@ private:
NavigationButton *m_backButton, *m_forwardButton, *m_reloadButton;
AddressBar *m_addressBar;
LoadingBar *m_progressBar;
+
+ bool m_tabBarAdded = false;
};
#endif // MAINWINDOW_H
diff --git a/src/widgets/webviewtabbar.cpp b/src/widgets/webviewtabbar.cpp
index c52e323..e662837 100644
--- a/src/widgets/webviewtabbar.cpp
+++ b/src/widgets/webviewtabbar.cpp
@@ -139,7 +139,7 @@ QSize WebViewTabBar::tabSizeHint(int index) const
void WebViewTabBar::handleCurrentChanged(int index)
{
if(index < 0) {
- addTab(profile()->newtab());
+ addTab(m_profile->newtab());
return;
}
emit currentTabChanged(m_views.at(index));