diff options
Diffstat (limited to 'sources/pyside6/tests/QtWidgets/bug_919.py')
| -rw-r--r-- | sources/pyside6/tests/QtWidgets/bug_919.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sources/pyside6/tests/QtWidgets/bug_919.py b/sources/pyside6/tests/QtWidgets/bug_919.py index 6f2fc128d..a95d3aa37 100644 --- a/sources/pyside6/tests/QtWidgets/bug_919.py +++ b/sources/pyside6/tests/QtWidgets/bug_919.py @@ -26,10 +26,11 @@ class MyWidget(QPushButton): self.paintReceived.emit() def paintEvent(self, e): - p = QPainter(self) - style = QApplication.style() - option = QStyleOptionButton() - style.drawControl(QStyle.ControlElement.CE_PushButton, option, p) + with QPainter(self) as p: + style = QApplication.style() + option = QStyleOptionButton() + self.initStyleOption(option) + style.drawControl(QStyle.ControlElement.CE_PushButton, option, p) self._painted = True QTimer.singleShot(0, self._emitPainted) |
