How to display a QGraphicsScene?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-20T19:45:06Z Indexed on 2010/03/21 3:21 UTC
Read the original article Hit count: 557

Filed under:
|
|

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/

© Stack Overflow or respective owner

Related posts about qt

Related posts about pyqt