Merge branch 'master' of https://github.com/dylanaraps/qutebrowser into dylanaraps-master

This commit is contained in:
Florian Bruhin 2015-12-07 21:12:37 +01:00
commit 3506947add
4 changed files with 25 additions and 2 deletions

View File

@ -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."),

View File

@ -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."""

View File

@ -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)

View File

@ -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(),