diff options
author | Jon Ander Peñalba <jonan88@gmail.com> | 2010-11-30 22:04:41 +0100 |
---|---|---|
committer | Jon Ander Peñalba <jonan88@gmail.com> | 2010-11-30 22:04:41 +0100 |
commit | 491f63610fc9f74ca8097a516347f1399cbc71c2 (patch) | |
tree | 6eb71f8db630de6e510af44441656443da68758b /src/tabbar.cpp | |
parent | Port SearchEngine from somewhat unsafe "naked" static variables to (diff) | |
download | rekonq-491f63610fc9f74ca8097a516347f1399cbc71c2.tar.xz |
Show and hide the add-tab button automatically
Diffstat (limited to 'src/tabbar.cpp')
-rw-r--r-- | src/tabbar.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 0866bfd8..286d7d45 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -77,11 +77,6 @@ TabBar::TabBar(QWidget *parent) } -TabBar::~TabBar() -{ -} - - QSize TabBar::tabSizeHint(int index) const { MainView *view = qobject_cast<MainView *>(parent()); @@ -189,6 +184,26 @@ void TabBar::showTabPreview() } +void TabBar::hideEvent(QHideEvent *event) +{ + if (!event->spontaneous()) + { + qobject_cast<MainView *>(parent())->addTabButton()->hide(); + } + QTabBar::hideEvent(event); +} + + +void TabBar::showEvent(QShowEvent *event) +{ + QTabBar::showEvent(event); + if (!event->spontaneous()) + { + qobject_cast<MainView *>(parent())->addTabButton()->show(); + } +} + + void TabBar::mouseMoveEvent(QMouseEvent *event) { if (count() == 1) @@ -338,9 +353,8 @@ void TabBar::mouseReleaseEvent(QMouseEvent *event) } -void TabBar::tabRemoved(int index) +void TabBar::tabRemoved(int /*index*/) { - Q_UNUSED(index) if (ReKonfig::alwaysShowTabPreviews()) { if (!m_previewPopup.isNull()) @@ -374,7 +388,7 @@ void TabBar::setupHistoryActions() if(!isEnabled) return; - foreach (const HistoryItem &item, mv->recentlyClosedTabs()) + Q_FOREACH(const HistoryItem &item, mv->recentlyClosedTabs()) { KAction *a = new KAction(Application::iconManager()->iconForUrl(item.url), item.title, this); a->setData(item.url); |