From 18a5c86abefbc51de3dc85929202acd2f7a319ec Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Sat, 22 Mar 2008 23:41:26 +0000 Subject: [PATCH] Close tabs when clicked with middle mouse button. BUG: 137938 svn path=/trunk/KDE/kdebase/apps/konsole/; revision=788960 --- src/ViewContainer.cpp | 6 ++++++ src/ViewContainer.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index ff231c712..fbfa40d55 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -471,6 +471,7 @@ TabbedViewContainerV2::TabbedViewContainerV2(NavigationPosition position , QObje connect( _tabBar , SIGNAL(tabDoubleClicked(int)) , this , SLOT(tabDoubleClicked(int)) ); connect( _tabBar , SIGNAL(newTabRequest()) , this , SIGNAL(newViewRequest()) ); connect( _tabBar , SIGNAL(wheelDelta(int)) , this , SLOT(wheelScrolled(int)) ); + connect( _tabBar , SIGNAL(mouseMiddleClick(int)) , this , SLOT(closeTab(int)) ); _layout = new TabbedViewContainerV2Layout; _layout->setSpacing(0); @@ -497,6 +498,11 @@ TabbedViewContainerV2::TabbedViewContainerV2(NavigationPosition position , QObje _containerWidget->setLayout(_layout); } +void TabbedViewContainerV2::closeTab(int tab) +{ + Q_ASSERT(tab >= 0 && tab < _stackWidget->count()); + removeView(_stackWidget->widget(tab)); +} void TabbedViewContainerV2::setTabBarVisible(bool visible) { _tabBar->setVisible(visible); diff --git a/src/ViewContainer.h b/src/ViewContainer.h index f1d7e6cfb..a16f549b0 100644 --- a/src/ViewContainer.h +++ b/src/ViewContainer.h @@ -407,7 +407,7 @@ private slots: void updateIcon(ViewProperties* item); void updateActivity(ViewProperties* item); void currentTabChanged(int index); - + void closeTab(int index); void wheelScrolled(int delta); void tabDoubleClicked(int index);