From 64df47b49f0f81622e54401d5cd92acc4eb192a7 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 25 Dec 2010 20:21:04 +0000 Subject: [PATCH] Fix tab bar visibility when the execution log tab is enabled --- src/hidabletabwidget.h | 20 ++++++++++++++++++++ src/mainwindow.cpp | 6 ------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/hidabletabwidget.h b/src/hidabletabwidget.h index d062084fd..0f941ec65 100644 --- a/src/hidabletabwidget.h +++ b/src/hidabletabwidget.h @@ -36,9 +36,29 @@ class HidableTabWidget : public QTabWidget { public: + void showTabBar(bool show) { tabBar()->setVisible(show); } + +protected: + void tabInserted(int index) { + QTabWidget::tabInserted(index); + if(count() == 1) { + showTabBar(false); + } else { + showTabBar(true); + } + } + + void tabRemoved(int index) { + QTabWidget::tabInserted(index); + if(count() == 1) { + showTabBar(false); + } else { + showTabBar(true); + } + } }; #endif // HIDABLETABWIDGET_H diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index aea4bd2e8..55eaf7494 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -385,13 +385,10 @@ void MainWindow::displayRSSTab(bool enable) { int index_tab = tabs->addTab(rssWidget, tr("RSS")); tabs->setTabIcon(index_tab, misc::getIcon("application-rss+xml")); } - tabs->showTabBar(true); } else { if(rssWidget) { delete rssWidget; } - if(!searchEngine) - tabs->showTabBar(false); } } @@ -402,13 +399,10 @@ void MainWindow::displaySearchTab(bool enable) { searchEngine = new SearchEngine(this); tabs->insertTab(1, searchEngine, misc::getIcon("edit-find"), tr("Search")); } - tabs->showTabBar(true); } else { if(searchEngine) { delete searchEngine; } - if(!rssWidget) - tabs->showTabBar(false); } }