aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtWidgets/bug_919.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2025-05-14 11:05:17 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-05-16 15:03:24 +0200
commit28c0061af6b17219ba2bda3a217b76b044e80bcd (patch)
treeda3baf5d5237d58a2e3afbbaee468e367e53ab0f /sources/pyside6/tests/QtWidgets/bug_919.py
parentf18e3a36b605ed08dab838b27460915dd18cd450 (diff)
Fix some warnings in tests
Fix exec_ and deprecated QMenu.addAction() overloads. Fix warnings about inactive QPainter in bug_919.py. Pick-to: 6.9 Change-Id: I483190480ca5b467bd070c3239f78166e6de3a51 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/tests/QtWidgets/bug_919.py')
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_919.py9
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)