Details
Description
When I try to call painter.device() in QGraphicsScene.drawForeground() method, I got
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Minimal working example:
from PySide2 import QtWidgets class MyScene(QtWidgets.QGraphicsScene): def drawBackground(self, painter, rect): print(painter.device()) painter.drawText(0, 0, 'Hi') super().drawBackground(painter, rect) def drawForeground(self, painter, rect): print(painter.device()) print(painter.device().physicalDpiX()) # <-- this causes termination painter.drawText(30, 0, 'Hallo') super().drawForeground(painter, rect) if __name__ == '__main__': app = QtWidgets.QApplication([]) scene = MyScene() scene.addText("Hello, world!") view = QtWidgets.QGraphicsView(scene) view.show() app.exec_()