Merge pull request #557 from ynput/bugfix/loader-pyside6-support

Loader tool: Fix PySide6 support
This commit is contained in:
Jakub Trllo 2024-05-27 16:00:29 +02:00 committed by GitHub
commit ca14637ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -107,7 +107,10 @@ class VersionDelegate(QtWidgets.QStyledItemDelegate):
style = QtWidgets.QApplication.style()
style.drawControl(
style.CE_ItemViewItem, option, painter, option.widget
QtWidgets.QCommonStyle.CE_ItemViewItem,
option,
painter,
option.widget
)
painter.save()
@ -119,9 +122,14 @@ class VersionDelegate(QtWidgets.QStyledItemDelegate):
pen.setColor(fg_color)
painter.setPen(pen)
text_rect = style.subElementRect(style.SE_ItemViewItemText, option)
text_rect = style.subElementRect(
QtWidgets.QCommonStyle.SE_ItemViewItemText,
option
)
text_margin = style.proxy().pixelMetric(
style.PM_FocusFrameHMargin, option, option.widget
QtWidgets.QCommonStyle.PM_FocusFrameHMargin,
option,
option.widget
) + 1
painter.drawText(
@ -207,14 +215,22 @@ class StatusDelegate(QtWidgets.QStyledItemDelegate):
style = QtWidgets.QApplication.style()
style.drawControl(
style.CE_ItemViewItem, option, painter, option.widget
QtWidgets.QCommonStyle.CE_ItemViewItem,
option,
painter,
option.widget
)
painter.save()
text_rect = style.subElementRect(style.SE_ItemViewItemText, option)
text_rect = style.subElementRect(
QtWidgets.QCommonStyle.SE_ItemViewItemText,
option
)
text_margin = style.proxy().pixelMetric(
style.PM_FocusFrameHMargin, option, option.widget
QtWidgets.QCommonStyle.PM_FocusFrameHMargin,
option,
option.widget
) + 1
padded_text_rect = text_rect.adjusted(
text_margin, 0, - text_margin, 0