move part of the logic to TabbedBrowser
This commit is contained in:
parent
45dea54e3c
commit
61519e6383
@ -577,3 +577,12 @@ class TabbedBrowser(tabwidget.TabWidget):
|
|||||||
"""
|
"""
|
||||||
super().resizeEvent(e)
|
super().resizeEvent(e)
|
||||||
self.resized.emit(self.geometry())
|
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)
|
||||||
|
@ -480,16 +480,18 @@ class TabBar(QTabBar):
|
|||||||
new_idx = super().insertTab(idx, icon, '')
|
new_idx = super().insertTab(idx, icon, '')
|
||||||
self.set_page_title(new_idx, text)
|
self.set_page_title(new_idx, text)
|
||||||
|
|
||||||
def wheelEvent(self, event):
|
def wheelEvent(self, e):
|
||||||
"""Override wheelEvent to make the action configurable."""
|
"""Override wheelEvent to make the action configurable.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
e: The QWheelEvent
|
||||||
|
"""
|
||||||
if config.get('tabs', 'mousewheel-tab-switching'):
|
if config.get('tabs', 'mousewheel-tab-switching'):
|
||||||
super().wheelEvent(event)
|
super().wheelEvent(e)
|
||||||
else:
|
else:
|
||||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||||
window=self._win_id)
|
window=self._win_id)
|
||||||
focused_tab = tabbed_browser.currentWidget()
|
tabbed_browser.wheelEvent(e)
|
||||||
if focused_tab is not None:
|
|
||||||
focused_tab.wheelEvent(event)
|
|
||||||
|
|
||||||
|
|
||||||
class TabBarStyle(QCommonStyle):
|
class TabBarStyle(QCommonStyle):
|
||||||
|
Loading…
Reference in New Issue
Block a user