Close the current tab when the tabbar itself is clicked

This commit is contained in:
Florian Bruhin 2017-04-25 06:59:51 +02:00
parent 3125b69d19
commit c3e6222296
2 changed files with 7 additions and 4 deletions

View File

@ -47,6 +47,8 @@ Changed
to frequent crashes due to a Qt bug.
- stdin is now closed immediately for processes spawned from qutebrowser
- When ui -> message-timeout is set to 0, messages are now never cleared.
- Middle/right-clicking the blank parts of the tab bar (when vertical) now
closes the current tab.
Fixed
~~~~~

View File

@ -395,11 +395,12 @@ class TabBar(QTabBar):
button = config.get('tabs', 'close-mouse-button')
if (e.button() == Qt.RightButton and button == 'right' or
e.button() == Qt.MiddleButton and button == 'middle'):
e.accept()
idx = self.tabAt(e.pos())
if idx != -1:
e.accept()
self.tabCloseRequested.emit(idx)
return
if idx == -1:
idx = self.currentIndex()
self.tabCloseRequested.emit(idx)
return
super().mousePressEvent(e)
def minimumTabSizeHint(self, index):