diff options
author | Christian Tismer <[email protected]> | 2022-01-26 12:21:19 +0100 |
---|---|---|
committer | Christian Tismer <[email protected]> | 2022-01-26 17:47:13 +0100 |
commit | dc2046124f132ba0187d1bff97364448288b1cd6 (patch) | |
tree | a9f9caa6de943019c06b62ef77905345eb93cafd /examples/widgets/effects | |
parent | c81ee3c92ac022bb5e9b3d0db72f157a1e1a6513 (diff) |
PyPySide: Implement a context manager for QPainter
Context managers existed in Python since 2005 (PEP 343).
They were invented to support resource management for
different Python implementations that cannot rely on
immediate object destruction.
PyPy is the first alternate Python implementation
that can run PySide. QPainter does not work in PyPy
without an explicit end() call. For convenience, we
supply a context manager that handles this. Like in
file I/O, we now prefer instead of
painter = QPainter(paintable)
the new indented form
with QPainter(paintable) as painter:
[ChangeLog][PySide6] QPainter has become a context manager.
Using a with statement saves the need to call painter.end() .
Task-number: PYSIDE-535
Change-Id: Ib8bebbe121dc08334d31c9663a1e5bc8042c3b62
Reviewed-by: Friedemann Kleint <[email protected]>
Diffstat (limited to 'examples/widgets/effects')
0 files changed, 0 insertions, 0 deletions