summaryrefslogtreecommitdiff
path: root/src/tabbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabbar.cpp')
-rw-r--r--src/tabbar.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 08603789..fd27db85 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -70,9 +70,21 @@ TabBar::~TabBar()
QSize TabBar::tabSizeHint(int index) const
{
- QSize s = m_parent->sizeHint();
+ //TODO Create a SuperTabWidget class
+
+ int buttonSize = ((MainView *)m_parent)->addTabButton()->size().width();
+ int tabBarWidth = m_parent->size().width() - buttonSize;
+ int baseWidth = m_parent->sizeHint().width()/4;
+ int minWidth = m_parent->sizeHint().width()/8;
+
+ int w;
+ if (baseWidth*count()<tabBarWidth)
+ w=baseWidth;
+ else if (tabBarWidth/count()>minWidth)
+ w=tabBarWidth/count();
+ else
+ w=minWidth;
- int w = s.width() / 4;
int h = KTabBar::tabSizeHint(index).height();
QSize ts = QSize(w, h);