diff --git a/README.asciidoc b/README.asciidoc index 8574cb119..c078214d7 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -195,6 +195,7 @@ Contributors, sorted by the number of commits in descending order: * rikn00 * kanikaa1234 * haitaka +* Sebastian Frysztak * Nick Ginther * Michał Góral * Michael Ilsaas diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index baeb7d620..657a38dc3 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -703,13 +703,10 @@ class TabBarStyle(QCommonStyle): text_rect.adjust(indicator_width + indicator_padding.left + indicator_padding.right, 0, 0, 0) - if opt.icon.isNull(): - icon_rect = QRect() - else: + icon_rect = self._get_icon_rect(opt, text_rect) + if icon_rect.isValid(): icon_padding = self.pixelMetric(PixelMetrics.icon_padding, opt) - icon_rect = self._get_icon_rect(opt, text_rect) - if icon_rect.isValid(): - text_rect.adjust(icon_rect.width() + icon_padding, 0, 0, 0) + text_rect.adjust(icon_rect.width() + icon_padding, 0, 0, 0) text_rect = self._style.visualRect(opt.direction, opt.rect, text_rect) return Layouts(text=text_rect, icon=icon_rect, @@ -733,9 +730,17 @@ class TabBarStyle(QCommonStyle): else QIcon.Disabled) icon_state = (QIcon.On if opt.state & QStyle.State_Selected else QIcon.Off) - tab_icon_size = opt.icon.actualSize(icon_size, icon_mode, icon_state) - tab_icon_size = QSize(min(tab_icon_size.width(), icon_size.width()), - min(tab_icon_size.height(), icon_size.height())) + # reserve space for favicon when tab bar is vertical (issue #1968) + position = config.get('tabs', 'position') + if (opt.icon.isNull() and + position in [QTabWidget.East, QTabWidget.West] and + config.get('tabs', 'show-favicons')): + tab_icon_size = icon_size + else: + actual_size = opt.icon.actualSize(icon_size, icon_mode, icon_state) + tab_icon_size = QSize( + min(actual_size.width(), icon_size.width()), + min(actual_size.height(), icon_size.height())) icon_rect = QRect(text_rect.left(), text_rect.top() + 1, tab_icon_size.width(), tab_icon_size.height()) icon_rect = self._style.visualRect(opt.direction, opt.rect, icon_rect) diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index 00f8b290d..bb84521d0 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -41,6 +41,7 @@ class TestTabWidget: 'position': 0, 'select-on-remove': 1, 'show': 'always', + 'show-favicons': True, 'padding': configtypes.PaddingValues(0, 0, 5, 5), 'indicator-width': 3, 'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4),