PySide and QGraphics, how to make a simple window with widgets?

  • Hi,
    I want to write a simple QGraphics based browser. I did one with "none-QGraphic" widgets, and it worked create. But i got some problems with QGraphics.
    Here is the code:

    import sys
    from PySide import QtGui, QtCore

    class FirstClass(QtGui.QMainWindow):

    def __init__(self):
        super(FirstClass, self).__init__()
    def startingUI(self):
        self.resize(800, 600)
        menue = self.menuBar()
        menuleiste_datei = menue.addMenu('File')
        self.mainWidget = QtGui.QGraphicsWidget()
        self.scene = QtGui.QGraphicsScene(self)
        self.url_input = QtGui.QLineEdit()
        self.layout = QtGui.QGraphicsLinearLayout()
        self.view = QtGui.QGraphicsView()

    def main():

    app = QtGui.QApplication(sys.argv)
    start = FirstClass()

    if name== 'main':


    I want to create a simple interface with a menubar, statusbar, a line input in which i can enter a url and then load it. All the new widgets i add dont get displayed. And i total don't understand the logic behind this.
    The first thing i have to do is to create a QtGui.QGraphicsWidget() right? And since my class inherits from QtGui.QMainWindow, that GraphicWidget is somehow imbedded into the QMainWindow? And what is the relation to all this with the QtGui.QGraphicsView ? Do i even use the right widgets?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.