Skip to content

Commit 70e160b

Browse files
committed
PySide6 compat.: workaround for polygon shape point slicing
1 parent d23f82c commit 70e160b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plotpy/items/shape/polygon.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,10 @@ def draw(
276276
painter.setBrush(brush)
277277
points = self.transform_points(xMap, yMap)
278278
if self.ADDITIONNAL_POINTS:
279-
shape_points = points[: -self.ADDITIONNAL_POINTS]
280-
other_points = points[-self.ADDITIONNAL_POINTS :]
279+
# Slice indexing is not supported by PySide6, so we convert the `QPolygonF`
280+
# object to a list before converting it back to a `QPolygonF` object:
281+
shape_points = QG.QPolygonF(list(points[: -self.ADDITIONNAL_POINTS]))
282+
other_points = QG.QPolygonF(list(points[-self.ADDITIONNAL_POINTS :]))
281283
else:
282284
shape_points = points
283285
other_points = []

0 commit comments

Comments
 (0)