Fix for TypeErrors when using certain styles

When i was using certain styles like cleanlooks or qt5ct-style, a TypeError was raising in cascade about the function not having enough arguments.
It looked like that, despite the last args of Qstyle.subElementRect() and Qstyle.sizeFromContents() were optional, it was still required to mention it (even if it was just None).
That TypeError was only appearing with certain styles, at startup or when changing styles in the settings window.
This commit is contained in:
FrancoisDuchene 2020-08-13 19:10:16 +02:00
parent 917f1a2f73
commit bd7b1e96f7
2 changed files with 3 additions and 3 deletions

View file

@ -313,7 +313,7 @@ class outlineLabelDelegate(QStyledItemDelegate):
idx = self.mdlLabels.indexFromItem(item)
opt = QStyleOptionViewItem(option)
self.initStyleOption(opt, idx)
s = qApp.style().sizeFromContents(QStyle.CT_ItemViewItem, opt, QSize())
s = qApp.style().sizeFromContents(QStyle.CT_ItemViewItem, opt, QSize(), None)
if s.width() > 150:
s.setWidth(150)
elif s.width() < 50:

View file

@ -34,8 +34,8 @@ class treeTitleDelegate(QStyledItemDelegate):
opt = QStyleOptionViewItem(option)
self.initStyleOption(opt, index)
iconRect = style.subElementRect(style.SE_ItemViewItemDecoration, opt)
textRect = style.subElementRect(style.SE_ItemViewItemText, opt)
iconRect = style.subElementRect(style.SE_ItemViewItemDecoration, opt, None)
textRect = style.subElementRect(style.SE_ItemViewItemText, opt, None)
# Background
style.drawPrimitive(style.PE_PanelItemViewItem, opt, painter)