From 45fc7f02d1e170f38249541d6dba77b519980884 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 27 May 2024 15:38:06 +0200 Subject: [PATCH 1/2] fix support for PySide6 in loader --- client/ayon_core/tools/loader/ui/products_delegates.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/loader/ui/products_delegates.py b/client/ayon_core/tools/loader/ui/products_delegates.py index 6bcb78ec66..51424034aa 100644 --- a/client/ayon_core/tools/loader/ui/products_delegates.py +++ b/client/ayon_core/tools/loader/ui/products_delegates.py @@ -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() @@ -207,7 +210,10 @@ 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() From afe0887d96e686937d3e1dca4acdaf7163eb11bf Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 27 May 2024 15:45:53 +0200 Subject: [PATCH 2/2] fix more constants --- .../tools/loader/ui/products_delegates.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/tools/loader/ui/products_delegates.py b/client/ayon_core/tools/loader/ui/products_delegates.py index 51424034aa..1ac19b53eb 100644 --- a/client/ayon_core/tools/loader/ui/products_delegates.py +++ b/client/ayon_core/tools/loader/ui/products_delegates.py @@ -122,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( @@ -218,9 +223,14 @@ class StatusDelegate(QtWidgets.QStyledItemDelegate): 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