Don't pass useless widget to tab_layout.
This commit is contained in:
parent
465ff7406c
commit
1d31f1eb48
@ -245,7 +245,7 @@ class TabBarStyle(QCommonStyle):
|
|||||||
super().drawControl(QStyle.CE_TabBarTabShape, opt, p, widget)
|
super().drawControl(QStyle.CE_TabBarTabShape, opt, p, widget)
|
||||||
elif element == QStyle.CE_TabBarTabLabel:
|
elif element == QStyle.CE_TabBarTabLabel:
|
||||||
p.fillRect(opt.rect, opt.palette.window())
|
p.fillRect(opt.rect, opt.palette.window())
|
||||||
text_rect, icon_rect = self._tab_layout(opt, widget)
|
text_rect, icon_rect = self._tab_layout(opt)
|
||||||
if not opt.icon.isNull():
|
if not opt.icon.isNull():
|
||||||
qt_ensure_valid(icon_rect)
|
qt_ensure_valid(icon_rect)
|
||||||
icon_mode = (QIcon.Normal if opt.state & QStyle.State_Enabled
|
icon_mode = (QIcon.Normal if opt.state & QStyle.State_Enabled
|
||||||
@ -295,12 +295,12 @@ class TabBarStyle(QCommonStyle):
|
|||||||
A QRect.
|
A QRect.
|
||||||
"""
|
"""
|
||||||
if sr == QStyle.SE_TabBarTabText:
|
if sr == QStyle.SE_TabBarTabText:
|
||||||
text_rect, _icon_rect = self._tab_layout(option, widget)
|
text_rect, _icon_rect = self._tab_layout(option)
|
||||||
return text_rect
|
return text_rect
|
||||||
else:
|
else:
|
||||||
return self._style.subElementRect(sr, option, widget)
|
return self._style.subElementRect(sr, option, widget)
|
||||||
|
|
||||||
def _tab_layout(self, opt, _widget):
|
def _tab_layout(self, opt):
|
||||||
"""Compute the text/icon rect from the opt rect.
|
"""Compute the text/icon rect from the opt rect.
|
||||||
|
|
||||||
This is based on Qt's QCommonStylePrivate::tabLayout
|
This is based on Qt's QCommonStylePrivate::tabLayout
|
||||||
@ -309,7 +309,6 @@ class TabBarStyle(QCommonStyle):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
opt: QStyleOptionTab
|
opt: QStyleOptionTab
|
||||||
_widget: QWidget
|
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
A (text_rect, icon_rect) tuple (both QRects).
|
A (text_rect, icon_rect) tuple (both QRects).
|
||||||
|
Loading…
Reference in New Issue
Block a user