Merge branch 'dylanaraps-master'
This commit is contained in:
commit
14c083f915
@ -186,6 +186,7 @@ Contributors, sorted by the number of commits in descending order:
|
||||
* Corentin Jule
|
||||
* zwarag
|
||||
* xd1le
|
||||
* dylan araps
|
||||
* Tim Harder
|
||||
* Thiago Barroso Perrotta
|
||||
* Samuel Loury
|
||||
|
@ -118,6 +118,7 @@
|
||||
|<<tabs-indicator-width,indicator-width>>|Width of the progress indicator (0 to disable).
|
||||
|<<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-title-alignment,title-alignment>>|Alignment of the text inside of tabs
|
||||
|<<tabs-mousewheel-tab-switching,mousewheel-tab-switching>>|Switch between tabs using the mouse wheel.
|
||||
|<<tabs-padding,padding>>|Padding for tabs (top, bottom, left, right).
|
||||
|<<tabs-indicator-padding,indicator-padding>>|Padding for indicators (top, bottom, left, right).
|
||||
@ -1127,6 +1128,18 @@ The format to use for the tab title. The following placeholders are defined:
|
||||
|
||||
Default: +pass:[{index}: {title}]+
|
||||
|
||||
[[tabs-title-alignment]]
|
||||
=== title-alignment
|
||||
Alignment of the text inside of tabs
|
||||
|
||||
Valid values:
|
||||
|
||||
* +left+
|
||||
* +right+
|
||||
* +center+
|
||||
|
||||
Default: +pass:[left]+
|
||||
|
||||
[[tabs-mousewheel-tab-switching]]
|
||||
=== mousewheel-tab-switching
|
||||
Switch between tabs using the mouse wheel.
|
||||
|
@ -625,6 +625,10 @@ def data(readonly=False):
|
||||
"* `{id}`: The internal tab ID of this tab.\n"
|
||||
"* `{scroll_pos}`: The page scroll position."),
|
||||
|
||||
('title-alignment',
|
||||
SettingValue(typ.TextAlignment(), 'left'),
|
||||
"Alignment of the text inside of tabs"),
|
||||
|
||||
('mousewheel-tab-switching',
|
||||
SettingValue(typ.Bool(), 'true'),
|
||||
"Switch between tabs using the mouse wheel."),
|
||||
|
@ -29,7 +29,7 @@ import collections
|
||||
import warnings
|
||||
import datetime
|
||||
|
||||
from PyQt5.QtCore import QUrl
|
||||
from PyQt5.QtCore import QUrl, Qt
|
||||
from PyQt5.QtGui import QColor, QFont
|
||||
from PyQt5.QtNetwork import QNetworkProxy
|
||||
from PyQt5.QtWidgets import QTabWidget, QTabBar
|
||||
@ -1336,6 +1336,22 @@ class Position(MappingType):
|
||||
valid_values=ValidValues('top', 'bottom', 'left', 'right'))
|
||||
|
||||
|
||||
class TextAlignment(MappingType):
|
||||
|
||||
"""Alignment of text."""
|
||||
|
||||
MAPPING = {
|
||||
'left': Qt.AlignLeft,
|
||||
'right': Qt.AlignRight,
|
||||
'center': Qt.AlignCenter,
|
||||
}
|
||||
|
||||
def __init__(self, none_ok=False):
|
||||
super().__init__(
|
||||
none_ok,
|
||||
valid_values=ValidValues('left', 'right', 'center'))
|
||||
|
||||
|
||||
class VerticalPosition(BaseType):
|
||||
|
||||
"""The position of the download bar."""
|
||||
|
@ -577,7 +577,8 @@ class TabBarStyle(QCommonStyle):
|
||||
elif element == QStyle.CE_TabBarTabLabel:
|
||||
if not opt.icon.isNull() and layouts.icon.isValid():
|
||||
self._draw_icon(layouts, opt, p)
|
||||
alignment = Qt.AlignLeft | Qt.AlignVCenter | Qt.TextHideMnemonic
|
||||
alignment = (config.get('tabs', 'title-alignment') |
|
||||
Qt.AlignVCenter | Qt.TextHideMnemonic)
|
||||
self._style.drawItemText(p, layouts.text, alignment, opt.palette,
|
||||
opt.state & QStyle.State_Enabled,
|
||||
opt.text, QPalette.WindowText)
|
||||
|
@ -24,6 +24,7 @@ import pytest
|
||||
from qutebrowser.mainwindow import tabwidget
|
||||
from qutebrowser.config import configtypes
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QFont, QColor
|
||||
from PyQt5.QtCore import Qt
|
||||
|
||||
|
||||
class TestTabWidget:
|
||||
@ -44,6 +45,7 @@ class TestTabWidget:
|
||||
'indicator-width': 3,
|
||||
'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4),
|
||||
'title-format': '{index}: {title}',
|
||||
'title-alignment': Qt.AlignLeft,
|
||||
},
|
||||
'colors': {
|
||||
'tabs.bg.bar': QColor(),
|
||||
|
Loading…
Reference in New Issue
Block a user