[Kst] branches/work/kst/portto4/kst/src/libkstapp

Peter Kümmel syntheticpp at gmx.net
Sun Sep 26 17:08:46 CEST 2010


SVN commit 1179932 by kuemmel:

only show tabbar when we need it

 M  +11 -0     tabwidget.cpp  
 M  +1 -0      tabwidget.h  


--- branches/work/kst/portto4/kst/src/libkstapp/tabwidget.cpp #1179931:1179932
@@ -88,6 +88,14 @@
 }
 
 
+void TabWidget::checkedShowTabbar() {
+  if (count() < 2) {
+    tabBar()->hide();
+  } else {
+    tabBar()->show();
+  }
+}
+
 void TabWidget::addView(View* view) {
   MainWindow *parent = qobject_cast<MainWindow*>(this->parent());
   if (parent) {
@@ -102,6 +110,7 @@
                   view->objectName();
 
   addTab(view, label);
+  checkedShowTabbar();
   setCurrentWidget(view);
 }
 
@@ -127,6 +136,7 @@
   }
   removeTab(indexOf(view));
   delete view;
+  checkedShowTabbar();
 }
 
 
@@ -136,6 +146,7 @@
     deleteView(view);
   }
   _cnt = 0;
+  checkedShowTabbar();
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/tabwidget.h #1179931:1179932
@@ -47,6 +47,7 @@
 
   private:
     int _cnt;
+    void checkedShowTabbar();
 };
 
 }


More information about the Kst mailing list