How do I add a QGraphicsScene to a QGridLayout?
I have this:
Code:
def __init__(self):
self.tree = TreeArea(self)
self.display = DisplayArea(self)
gridLayout.addWidget(self.tree, 0, 0)
gridLayout.addWidget(self.display, 0, 1)
where TreeArea is:
Code:
def __init__(self, parent):
and DisplayArea is:
Code:
def __init__(self, parent):
Qt doesn't like it when I do gridLayout.addWidget(self.display, 0, 1) since self.display does not inherit QWidget. So how do I add a QGraphicsScene to a layout?
Re: How do I add a QGraphicsScene to a QGridLayout?
you can add only widgets to a layout. Widgets are those you see on the screen. A QGraphicScene is a model class; in other words stores information/data about a scene. You should create a QGraphicsView and add that to the layout.
Re: How do I add a QGraphicsScene to a QGridLayout?
QGraphicScene is for rendering designing area for QGraphicsView() . so instaed of adding QGraphicsScene u first design a QGraphicsView() with the QGraphicsScene and add that graphicsView to your widget mainwindow
Re: How do I add a QGraphicsScene to a QGridLayout?
Thank you, that has worked.