summaryrefslogtreecommitdiff
path: root/src/tabwindow/tabwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-08-21 17:24:57 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:05 +0100
commit79170a62caf1cea6ab167ef6fe49d319a6eb9f29 (patch)
treea2c37853d86da56bf61c2649631463d2eae2d578 /src/tabwindow/tabwindow.cpp
parentGet sure rekonq makes use of djvu plugin (diff)
downloadrekonq-79170a62caf1cea6ab167ef6fe49d319a6eb9f29.tar.xz
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
Diffstat (limited to 'src/tabwindow/tabwindow.cpp')
-rw-r--r--src/tabwindow/tabwindow.cpp33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index 89ee76b9..0aafeb0d 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -85,6 +85,8 @@ TabWindow::TabWindow(bool withTab, QWidget *parent)
connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
connect(tabBar, SIGNAL(restoreClosedTab(int)), this, SLOT(restoreClosedTab(int)));
+ connect(tabBar, SIGNAL(tabLayoutChanged()), this, SLOT(updateNewTabButtonPosition()));
+
// new tab button
KAction* a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
_addTabButton->setDefaultAction(a);
@@ -195,8 +197,6 @@ void TabWindow::loadUrl(const KUrl &url, Rekonq::OpenType type, TabHistory *hist
{
history->applyHistory(tab->page()->history());
}
-
- updateTabBar();
}
@@ -214,9 +214,6 @@ void TabWindow::pageCreated(WebPage *page)
// Now, the dirty jobs...
_openedTabsCounter++;
insertTab(currentIndex() + _openedTabsCounter, tab, i18n("new tab"));
-
- // Finally, update tab bar...
- updateTabBar();
}
@@ -238,39 +235,22 @@ void TabWindow::currentChanged(int newIndex)
}
-void TabWindow::resizeEvent(QResizeEvent *event)
-{
- QTabWidget::resizeEvent(event);
- updateTabBar();
-}
-
-
-void TabWindow::updateTabBar()
+void TabWindow::updateNewTabButtonPosition()
{
- // update tab button position
- static bool ButtonInCorner = false;
-
int tabWidgetWidth = frameSize().width();
int tabBarWidth = tabBar()->sizeHint().width();
if (tabBarWidth + _addTabButton->width() > tabWidgetWidth)
{
- if (ButtonInCorner)
- return;
setCornerWidget(_addTabButton);
- ButtonInCorner = true;
}
else
{
- if (ButtonInCorner)
- {
- setCornerWidget(0);
- ButtonInCorner = false;
- }
-
+ setCornerWidget(0);
_addTabButton->move(tabBarWidth, 0);
- _addTabButton->show();
}
+
+ _addTabButton->show();
}
@@ -411,7 +391,6 @@ void TabWindow::closeTab(int index, bool del)
}
removeTab(index);
- updateTabBar(); // UI operation: do it ASAP!!
if (del)
{