From 79170a62caf1cea6ab167ef6fe49d319a6eb9f29 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 21 Aug 2012 17:24:57 +0200 Subject: Fix tabbar size & new tab button position Also, set tab preview popup width fixed This is heavily based on commits about this problem by Yoann Laissus. I modified a bit them to fit there + added (based on his idea) a double fixed size (default + minimal) for tabs --- src/tabwindow/tabbar.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/tabwindow/tabbar.cpp') diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp index 6f7586d0..91d5e402 100644 --- a/src/tabwindow/tabbar.cpp +++ b/src/tabwindow/tabbar.cpp @@ -89,16 +89,15 @@ QSize TabBar::tabSizeHint(int index) const QWidget* p = qobject_cast(parent()); - int maxTabBarWidth = p->size().width(); - - int baseTabWidth = maxTabBarWidth / genericTabNumber; - - int minTabWidth = p->sizeHint().width() / genericTabNumber; - - int w = baseTabWidth; - if (count() > genericTabNumber) + int tabWidgetWidth = p->size().width(); + int w = c_baseTabWidth; + if (w * count() > tabWidgetWidth) { - w = minTabWidth; + w = tabWidgetWidth / count(); + if (w < c_minTabWidth) + { + w = c_minTabWidth; + } } int h = size().height(); @@ -394,6 +393,13 @@ void TabBar::mousePressEvent(QMouseEvent *event) } +void TabBar::tabLayoutChange() +{ + KTabBar::tabLayoutChange(); + emit tabLayoutChanged(); +} + + void TabBar::showTabPreview() { if (m_isFirstTimeOnTab) @@ -416,7 +422,7 @@ void TabBar::showTabPreview() if (indexedTab->isLoading()) return; - int w = tabSizeHint(0).width(); + int w = c_baseTabWidth; int h = w * tabW->size().height() / tabW->size().width(); m_previewPopup = new TabPreviewPopup(indexedTab->tabPreview(w,h), indexedTab->url().url() , this); -- cgit v1.2.1