summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
authormegabigbug <megabigbug@arrakis.(none)>2009-08-01 23:02:38 +0200
committermegabigbug <megabigbug@arrakis.(none)>2009-08-01 23:02:38 +0200
commitead1bfba857fca72643620ec211436aac5a12a8f (patch)
tree000121d3c35fdd91d576be6a5bea669017e5f4e6 /src/mainview.cpp
parentMerge branch 'FOCUSOUT' (diff)
downloadrekonq-ead1bfba857fca72643620ec211436aac5a12a8f.tar.xz
Dynamic tab bar
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 5fc24512..c0294af5 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -107,13 +107,10 @@ void MainView::addTabButtonPosition()
{
static bool ButtonInCorner = false;
- QSize s1 = frameSize();
- int tabWidgetWidth = s1.width();
+ int tabWidgetWidth = frameSize().width();
+ int tabBarWidth = tabBar()->tabSizeHint(0).width()*tabBar()->count();
- QSize s2 = tabBar()->sizeHint();
- int newPos = s2.width();
-
- if( newPos > tabWidgetWidth )
+ if (tabBarWidth + m_addTabButton->width() > tabWidgetWidth)
{
if(ButtonInCorner)
return;
@@ -128,9 +125,15 @@ void MainView::addTabButtonPosition()
m_addTabButton->show();
ButtonInCorner = false;
}
+
+ int newPos = tabWidgetWidth - m_addTabButton->width();
m_addTabButton->move(newPos, 0);
- }
+ if (tabBar()->tabSizeHint(0).width()>=sizeHint().width()/4)
+ m_addTabButton->move(tabBarWidth, 0);
+ else
+ m_addTabButton->move(tabWidgetWidth - m_addTabButton->width(), 0);
+ }
}
@@ -145,6 +148,10 @@ TabBar *MainView::tabBar() const
return m_tabBar;
}
+QToolButton *MainView::addTabButton() const
+{
+ return m_addTabButton;
+}
StackedUrlBar *MainView::urlBarStack() const
{
@@ -675,3 +682,10 @@ void MainView::mouseDoubleClickEvent(QMouseEvent *event) //WARNING Need to be fi
}
KTabWidget::mouseDoubleClickEvent(event);
}
+
+
+void MainView::resizeEvent(QResizeEvent *event)
+{
+ addTabButtonPosition();
+ KTabWidget::resizeEvent(event);
+} \ No newline at end of file