From 296daf6865daf07d75b9dfa5ff96c003f68f4410 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 17 Oct 2012 21:59:13 +0200 Subject: Fix tab bar visibility when set as auto-hide BUG: 308421 --- src/mainview.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/mainview.cpp b/src/mainview.cpp index 15e0d5e4..b71a81ea 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -160,40 +160,40 @@ QList MainView::recentlyClosedTabs() void MainView::updateTabBarVisibility() { - if (ReKonfig::alwaysShowTabBar() || count() > 1) - { - // Get sure tabbar is well shown (and hided) during fullscreen navigation - // NOTE: don't ask me why, but it seems that using code like: - // MainWindow *w = qobject_cast(parent()); - // does NOT work here. So, I'm asking you: WHY??? - MainWindow *w = rApp->mainWindow(); - if (w && !w->isFullScreen()) + // Get sure tabbar is well shown (and hided) during fullscreen navigation + // NOTE: don't ask me why, but it seems that using code like: + // MainWindow *w = qobject_cast(parent()); + // does NOT work here. So, I'm asking you: WHY??? + MainWindow *w = rApp->mainWindow(); + if (w && !w->isFullScreen()) + { + if (tabBar()->isHidden()) { - if (tabBar()->isHidden()) - { - tabBar()->show(); - } - - // this to ensure tab button visibility also on new window creation - if (m_addTabButton->isHidden()) - { - m_addTabButton->show(); - } + tabBar()->show(); + } + + // this to ensure tab button visibility also on new window creation + if (m_addTabButton->isHidden()) + { + m_addTabButton->show(); } - } - else - { - tabBar()->hide(); - m_addTabButton->hide(); - return; } } void MainView::updateAddTabButton() { - // update tab button position + if (!ReKonfig::alwaysShowTabBar()) + { + bool b = (count() == 1); + + tabBar()->setVisible(!b); + m_addTabButton->setVisible(!b); + if (b) + return; + } + // update tab button position int tabWidgetWidth = frameSize().width(); int tabBarWidth = tabBar()->sizeHint().width(); -- cgit v1.2.1