From 23c7c1065621860eee7b07b5c08e5826ef6d6cb8 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 23 Aug 2007 08:56:13 +0000 Subject: [PATCH] Hide tab bar if there's only one tab. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19746 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 95b7ab0bf6..cb9114f1c7 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -121,6 +121,12 @@ private: }; +class TabWidget: public QTabWidget { +public: + void showBar(bool show) { tabBar()->setVisible(show); } +}; + + } // namespace anon @@ -131,7 +137,7 @@ struct GuiView::GuiViewPrivate int posx_offset; int posy_offset; - QTabWidget * tab_widget_; + TabWidget * tab_widget_; QStackedWidget * stack_widget_; BackgroundWidget * bg_widget_; @@ -227,7 +233,7 @@ GuiView::GuiView(int id) setWindowIcon(QPixmap(toqstr(iconname.absFilename()))); #endif - d.tab_widget_ = new QTabWidget; + d.tab_widget_ = new TabWidget; QPushButton * closeTabButton = new QPushButton(this); FileName const file = support::libFileSearch("images", "closetab", "xpm"); @@ -861,6 +867,8 @@ WorkArea * GuiView::addWorkArea(Buffer & buffer) wa->bufferView().updateMetrics(false); if (d.stack_widget_) d.stack_widget_->setCurrentWidget(d.tab_widget_); + // Hide tabbar if there's only one tab. + d.tab_widget_->showBar(d.tab_widget_->count() > 1); return wa; } @@ -925,6 +933,8 @@ void GuiView::removeWorkArea(WorkArea * work_area) if (d.tab_widget_->count()) { // make sure the next work area is enabled. d.tab_widget_->currentWidget()->setUpdatesEnabled(true); + // Hide tabbar if there's only one tab. + d.tab_widget_->showBar(d.tab_widget_->count() > 1); return; }