Merge branch 'sebastian-frysztak-master'
This commit is contained in:
commit
69889f6bba
@ -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
|
||||
|
@ -703,12 +703,9 @@ 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_padding = self.pixelMetric(PixelMetrics.icon_padding, opt)
|
||||
icon_rect = self._get_icon_rect(opt, text_rect)
|
||||
if icon_rect.isValid():
|
||||
icon_padding = self.pixelMetric(PixelMetrics.icon_padding, opt)
|
||||
text_rect.adjust(icon_rect.width() + icon_padding, 0, 0, 0)
|
||||
|
||||
text_rect = self._style.visualRect(opt.direction, opt.rect, text_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)
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user