Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

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

$
0
0
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?

Viewing all articles
Browse latest Browse all 18427

Trending Articles