Merge branch 'favicon-size' of https://github.com/Carpetsmoker/qutebrowser into tabbar-height

This commit is contained in:
Florian Bruhin 2015-08-01 00:22:17 +02:00
commit 2c716dbf6c
2 changed files with 9 additions and 4 deletions

View File

@ -23,7 +23,7 @@ import functools
import collections
from PyQt5.QtWidgets import QSizePolicy
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QSize, QTimer, QUrl
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QTimer, QUrl
from PyQt5.QtGui import QIcon
from qutebrowser.config import config
@ -108,9 +108,6 @@ class TabbedBrowser(tabwidget.TabWidget):
self._undo_stack = []
self._filter = signalfilter.SignalFilter(win_id, self)
self._now_focused = None
# FIXME adjust this to font size
# https://github.com/The-Compiler/qutebrowser/issues/119
self.setIconSize(QSize(12, 12))
objreg.get('config').changed.connect(self.update_favicons)
objreg.get('config').changed.connect(self.update_window_title)
objreg.get('config').changed.connect(self.update_tab_titles)

View File

@ -21,6 +21,7 @@
import collections
import functools
import math
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QSize, QRect, QPoint, QTimer
from PyQt5.QtWidgets import (QTabWidget, QTabBar, QSizePolicy, QCommonStyle,
@ -293,6 +294,13 @@ class TabBar(QTabBar):
"""Set the tab bar font."""
self.setFont(config.get('fonts', 'tabbar'))
def resizeEvent(self, _s):
"""Set the favicon size to the tabbar size minus some padding."""
height = self.size().height()
if height > 0:
height = math.ceil(height - height / 7)
self.setIconSize(QSize(height, height))
@config.change_filter('colors', 'tabs.bg.bar')
def set_colors(self):
"""Set the tab bar colors."""