How to display a QGraphicsScene?
- by Chris
I've got the following code and I'm not sure how to add the QGraphicsScene to my layout..
class MainForm(QDialog):
def __init__(self, parent=None):
super(MainForm, self).__init__(parent)
self.scene = QGraphicsScene(self)
self.scene.setSceneRect(0, 0, 500, 500)
self.view = QGraphicsView()
self.view.setRenderHint(QPainter.Antialiasing)
self.view.setScene(self.scene)
self.view.setFocusPolicy(Qt.NoFocus)
zoomSlider = QSlider(Qt.Horizontal)
zoomSlider.setRange(5, 200)
zoomSlider.setValue(100)
self.pauseButton = QPushButton("Pause")
quitButton = QPushButton("Quit")
layout = QVBoxLayout()
layout.addWidget(zoomSlider)
self.setLayout(layout)
self.startTimer(10)
How can I get my QGraphicsScene running? I'm new to Qt. Am I even supposed to be adding a QGraphicsScene to a layout/