Skip to content

Commit

Permalink
PySide6 compat.: workaround for polygon shape point slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Sep 10, 2024
1 parent d23f82c commit 70e160b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plotpy/items/shape/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down

0 comments on commit 70e160b

Please sign in to comment.