Skip to content

Commit

Permalink
End painter when drawing colormap (#262)
Browse files Browse the repository at this point in the history
* End painter when drawing colormap

* Only end painter if we created it
  • Loading branch information
gselzer authored Dec 13, 2024
1 parent c9528ff commit 2f3113f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/superqt/cmap/_cmap_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def paintEvent(self, event) -> None:
painter.setBrush(gradient)
painter.drawRect(rect)

# If we created a new Painter, free its resources
if isinstance(painter_or_device, QPaintDevice):
painter.end()


def _draw_checkerboard(
painter: QPainter, rect: QRect | QRectF, checker_size: int
Expand Down

0 comments on commit 2f3113f

Please sign in to comment.