Merge branch 'tharugrim-master'

This commit is contained in:
Florian Bruhin 2015-05-26 10:30:28 +02:00
commit 11c03d79cd
5 changed files with 41 additions and 0 deletions

View File

@ -150,6 +150,7 @@ Contributors, sorted by the number of commits in descending order:
* Error 800
* Brian Jackson
* sbinix
* Tobias Patzl
* Johannes Altmanninger
* Samir Benmendil
* Regina Hug

View File

@ -111,6 +111,7 @@
|<<tabs-indicator-space,indicator-space>>|Spacing between tab edge and indicator.
|<<tabs-tabs-are-windows,tabs-are-windows>>|Whether to open windows instead of tabs.
|<<tabs-title-format,title-format>>|The format to use for the tab title. The following placeholders are defined:
|<<tabs-mousewheel-tab-switching,mousewheel-tab-switching>>|Switch between tabs using the mouse wheel.
|==============
.Quick reference for section ``storage''
@ -1031,6 +1032,17 @@ The format to use for the tab title. The following placeholders are defined:
Default: +pass:[{index}: {title}]+
[[tabs-mousewheel-tab-switching]]
=== mousewheel-tab-switching
Switch between tabs using the mouse wheel.
Valid values:
* +true+
* +false+
Default: +pass:[true]+
== storage
Settings related to cache and storage.

View File

@ -522,6 +522,10 @@ def data(readonly=False):
"* `{index}`: The index of this tab.\n"
"* `{id}`: The internal tab ID of this tab."),
('mousewheel-tab-switching',
SettingValue(typ.Bool(), 'true'),
"Switch between tabs using the mouse wheel."),
readonly=readonly
)),

View File

@ -577,3 +577,14 @@ 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)
else:
e.ignore()

View File

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