Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. PySide and QGraphics, how to make a simple window with widgets?

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

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JonnyPython
    wrote on last edited by
    #1

    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__()
        self.startingUI()
    
    
    def startingUI(self):
    
        self.setWindowTitle('Hauptfenster')
        self.resize(800, 600)
        menue = self.menuBar()
        self.statusBar()
        menuleiste_datei = menue.addMenu('File')
    
    
        self.mainWidget = QtGui.QGraphicsWidget()
        self.scene = QtGui.QGraphicsScene(self)
    
        self.url_input = QtGui.QLineEdit()
        self.layout = QtGui.QGraphicsLinearLayout()
        self.scene.addWidget(self.url_input)
        self.mainWidget.setLayout(self.layout)
    
        self.view = QtGui.QGraphicsView()
        self.setCentralWidget(self.view)
    
    
        self.view.show()
    
        self.show()
    

    def main():

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

    if name== 'main':
    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved