aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/stardelegate/stareditor.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/itemviews/stardelegate/stareditor.py')
-rw-r--r--examples/widgets/itemviews/stardelegate/stareditor.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/widgets/itemviews/stardelegate/stareditor.py b/examples/widgets/itemviews/stardelegate/stareditor.py
index 9e3a5f4df..93027276c 100644
--- a/examples/widgets/itemviews/stardelegate/stareditor.py
+++ b/examples/widgets/itemviews/stardelegate/stareditor.py
@@ -70,10 +70,8 @@ class StarEditor(QWidget):
def paintEvent(self, event):
""" Paint the editor, offloading the work to the StarRating class. """
- painter = QPainter(self)
- self.star_rating.paint(painter, self.rect(), self.palette(), isEditable=True)
- # QPainter needs an explicit end() in PyPy. This will become a context manager in 6.3.
- painter.end()
+ with QPainter(self) as painter:
+ self.star_rating.paint(painter, self.rect(), self.palette(), isEditable=True)
def mouseMoveEvent(self, event):
""" As the mouse moves inside the editor, track the position and