From 70e160b0ce7bbcaa5d126985f6da0ae7c25896bb Mon Sep 17 00:00:00 2001 From: Pierre Raybaut Date: Tue, 10 Sep 2024 14:19:12 +0200 Subject: [PATCH] PySide6 compat.: workaround for polygon shape point slicing --- plotpy/items/shape/polygon.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plotpy/items/shape/polygon.py b/plotpy/items/shape/polygon.py index 207c278..a739a91 100644 --- a/plotpy/items/shape/polygon.py +++ b/plotpy/items/shape/polygon.py @@ -276,8 +276,10 @@ def draw( painter.setBrush(brush) points = self.transform_points(xMap, yMap) if self.ADDITIONNAL_POINTS: - shape_points = points[: -self.ADDITIONNAL_POINTS] - other_points = points[-self.ADDITIONNAL_POINTS :] + # Slice indexing is not supported by PySide6, so we convert the `QPolygonF` + # object to a list before converting it back to a `QPolygonF` object: + shape_points = QG.QPolygonF(list(points[: -self.ADDITIONNAL_POINTS])) + other_points = QG.QPolygonF(list(points[-self.ADDITIONNAL_POINTS :])) else: shape_points = points other_points = []