diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 0fee63902..41151c29d 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -1883,8 +1883,8 @@ bool QupZilla::event(QEvent* event) menuBar()->setVisible(m_menuBarVisible); statusBar()->setVisible(m_statusBarVisible); m_navigationContainer->show(); - m_tabWidget->showTabBar(); m_tabWidget->getTabBar()->updateVisibilityWithFullscreen(true); + m_tabWidget->getTabBar()->setVisible(true); #ifndef Q_OS_MAC m_navigationBar->setSuperMenuVisible(!m_menuBarVisible); #endif diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index 07e0f852e..4e630fe6f 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -76,20 +76,25 @@ void TabBar::loadSettings() { Settings settings; settings.beginGroup("Browser-Tabs-Settings"); - + m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool(); m_tabPreview->setAnimationsEnabled(settings.value("tabPreviewAnimationsEnabled", true).toBool()); m_showTabPreviews = settings.value("showTabPreviews", true).toBool(); bool activateLastTab = settings.value("ActivateLastTabWhenClosingActual", false).toBool(); + settings.endGroup(); setSelectionBehaviorOnRemove(activateLastTab ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab); - - settings.endGroup(); } void TabBar::updateVisibilityWithFullscreen(bool visible) { // It is needed to save original geometry, otherwise // tabbar will get 3px height in fullscreen once it was hidden + + // Make sure to honor user preference + if (visible) { + visible = !(count() == 1 && m_hideTabBarWithOneTab); + } + QTabBar::setVisible(visible); if (visible) { @@ -104,11 +109,16 @@ void TabBar::updateVisibilityWithFullscreen(bool visible) void TabBar::setVisible(bool visible) { - if (visible) { - if (p_QupZilla->isFullScreen()) { - return; - } + if (visible && p_QupZilla->isFullScreen()) { + return; + } + // Make sure to honor user preference + if (visible) { + visible = !(count() == 1 && m_hideTabBarWithOneTab); + } + + if (visible) { emit showButtons(); } else { @@ -117,7 +127,6 @@ void TabBar::setVisible(bool visible) } hideTabPreview(false); - QTabBar::setVisible(visible); } @@ -493,12 +502,20 @@ void TabBar::hideTabPreview(bool delayed) } } +void TabBar::tabInserted(int index) +{ + Q_UNUSED(index) + + setVisible(!(count() == 1 && m_hideTabBarWithOneTab)); +} + void TabBar::tabRemoved(int index) { Q_UNUSED(index) m_tabWidget->showNavigationBar(p_QupZilla->navigationContainer()); showCloseButton(currentIndex()); + setVisible(!(count() == 1 && m_hideTabBarWithOneTab)); } void TabBar::mouseDoubleClickEvent(QMouseEvent* event) diff --git a/src/lib/webview/tabbar.h b/src/lib/webview/tabbar.h index f06d5a783..14cfdd827 100644 --- a/src/lib/webview/tabbar.h +++ b/src/lib/webview/tabbar.h @@ -88,6 +88,7 @@ private slots: private: inline bool validIndex(int index) const { return index >= 0 && index < count(); } + void tabInserted(int index); void tabRemoved(int index); void hideCloseButton(int index); @@ -110,6 +111,7 @@ private: QTimer* m_tabPreviewTimer; bool m_showTabPreviews; + bool m_hideTabBarWithOneTab; int m_clickedTab; int m_pinnedTabsCount; diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index a065f7e03..831352a1b 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -145,7 +145,6 @@ void TabWidget::loadSettings() { Settings settings; settings.beginGroup("Browser-Tabs-Settings"); - m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool(); m_dontQuitWithOneTab = settings.value("dontQuitWithOneTab", false).toBool(); m_closedInsteadOpened = settings.value("closedInsteadOpenedTabs", false).toBool(); m_newTabAfterActive = settings.value("newTabAfterActive", true).toBool(); @@ -480,20 +479,6 @@ void TabWidget::tabMoved(int before, int after) m_lastTabIndex = before; } -void TabWidget::tabInserted(int index) -{ - Q_UNUSED(index) - - tabBar()->setVisible(!(count() == 1 && m_hideTabBarWithOneTab)); -} - -void TabWidget::tabRemoved(int index) -{ - Q_UNUSED(index) - - tabBar()->setVisible(!(count() == 1 && m_hideTabBarWithOneTab)); -} - void TabWidget::startTabAnimation(int index) { if (!validIndex(index)) { @@ -605,16 +590,6 @@ void TabWidget::reloadTab(int index) weTab(index)->reload(); } -void TabWidget::showTabBar() -{ - if (count() == 1 && m_hideTabBarWithOneTab) { - tabBar()->hide(); - } - else { - tabBar()->show(); - } -} - int TabWidget::lastTabIndex() const { return m_lastTabIndex; diff --git a/src/lib/webview/tabwidget.h b/src/lib/webview/tabwidget.h index b2c1933ae..ee6805e22 100644 --- a/src/lib/webview/tabwidget.h +++ b/src/lib/webview/tabwidget.h @@ -79,8 +79,6 @@ public: int normalTabsCount() const; int pinnedTabsCount() const; - - void showTabBar(); int lastTabIndex() const; void showNavigationBar(QWidget* bar); @@ -137,12 +135,8 @@ private: inline bool validIndex(int index) const { return index >= 0 && index < count(); } - void tabInserted(int index); - void tabRemoved(int index); - void resizeEvent(QResizeEvent* e); - bool m_hideTabBarWithOneTab; bool m_dontQuitWithOneTab; bool m_closedInsteadOpened; bool m_newTabAfterActive; diff --git a/src/lib/webview/webtab.cpp b/src/lib/webview/webtab.cpp index 70a3de118..a5b53a3a5 100644 --- a/src/lib/webview/webtab.cpp +++ b/src/lib/webview/webtab.cpp @@ -359,7 +359,13 @@ void WebTab::showNavigationBar(QWidget* bar) // Needed to prevent flickering when closing tabs m_navigationContainer->setUpdatesEnabled(true); - m_navigationContainer->show(); + + if (p_QupZilla->isFullScreen()) { + m_navigationContainer->setVisible(p_QupZilla->tabWidget()->getTabBar()->isVisible()); + } + else { + m_navigationContainer->show(); + } } } diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 728461c88..6262f7093 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -159,15 +159,11 @@ void WebView::setPage(QWebPage* page) mApp->plugins()->emitWebPageCreated(m_page); - /* Set white background by default. - Fixes issue with dark themes. - - See #602 - */ + // Set white background by default. + // Fixes issue with dark themes. See #602 QPalette pal = palette(); pal.setBrush(QPalette::Base, Qt::white); page->setPalette(pal); - } void WebView::load(const QUrl &url)