Merge remote-tracking branch 'origin/pr/4309'

This commit is contained in:
Florian Bruhin 2019-03-04 13:43:26 +01:00
commit 05a65fdb2f
2 changed files with 12 additions and 1 deletions

View File

@ -355,6 +355,17 @@ class TabWidget(QTabWidget):
if config.val.tabs.tabs_are_windows:
self.window().setWindowIcon(self.window().windowIcon())
def setTabIcon(self, idx: int, icon: QIcon):
"""Add overrides for setting tab icon sometimes when it is empty."""
tab = self.widget(idx)
if (icon.isNull() and
config.cache['tabs.favicons.show'] != 'never' and
config.cache['tabs.pinned.shrink'] and
not self.tabBar().vertical and
tab is not None and tab.data.pinned):
icon = self.style().standardIcon(QStyle.SP_FileIcon)
super().setTabIcon(idx, icon)
class TabBar(QTabBar):

View File

@ -85,7 +85,7 @@ class TestTabWidget:
widget.addTab(fake_web_tab(), 'foobar' + str(i))
# Set pinned title format longer than unpinned
config_stub.val.tabs.title.format_pinned = "_" * 20
config_stub.val.tabs.title.format_pinned = "_" * 10
config_stub.val.tabs.title.format = "_" * 2
config_stub.val.tabs.pinned.shrink = shrink_pinned
if vertical: