move part of the logic to TabbedBrowser

This commit is contained in:
Tobias Patzl 2015-05-25 20:21:37 +02:00
parent 45dea54e3c
commit 61519e6383
2 changed files with 17 additions and 6 deletions

View File

@ -577,3 +577,12 @@ class TabbedBrowser(tabwidget.TabWidget):
"""
super().resizeEvent(e)
self.resized.emit(self.geometry())
def wheelEvent(self, e):
"""Override wheelEvent of QWidget to forward it to the focused tab.
Args:
e: The QWheelEvent
"""
if self._now_focused is not None:
self._now_focused.wheelEvent(e)

View File

@ -480,16 +480,18 @@ class TabBar(QTabBar):
new_idx = super().insertTab(idx, icon, '')
self.set_page_title(new_idx, text)
def wheelEvent(self, event):
"""Override wheelEvent to make the action configurable."""
def wheelEvent(self, e):
"""Override wheelEvent to make the action configurable.
Args:
e: The QWheelEvent
"""
if config.get('tabs', 'mousewheel-tab-switching'):
super().wheelEvent(event)
super().wheelEvent(e)
else:
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=self._win_id)
focused_tab = tabbed_browser.currentWidget()
if focused_tab is not None:
focused_tab.wheelEvent(event)
tabbed_browser.wheelEvent(e)
class TabBarStyle(QCommonStyle):