Hi all,
I'm having troubles stretching QGraphicsViews automatically when the size of my window adjusts.
This is the code I have at the moment.
self.leftview.setFixedSize(550,600)
self.rightview.setFixedSize(550,600)
leftrect
= QtCore.
QRectF(self.
leftview.
rect())rightrect
= QtCore.
QRectF(self.
rightview.
rect())leftrect.adjust(1,1,-1,-1)
rightrect.adjust(1,1,-1,-1)
self.leftscene = TEMDrawer.DiagramScene(leftrect)
self.rightscene = TEMDrawer.DiagramScene(rightrect)
self.leftview.setScene(self.leftscene)
self.rightview.setScene(self.rightscene)
self.leftview = QtGui.QGraphicsView()
self.rightview = QtGui.QGraphicsView()
self.leftview.setFixedSize(550,600)
self.rightview.setFixedSize(550,600)
leftrect = QtCore.QRectF(self.leftview.rect())
rightrect = QtCore.QRectF(self.rightview.rect())
leftrect.adjust(1,1,-1,-1)
rightrect.adjust(1,1,-1,-1)
self.leftscene = TEMDrawer.DiagramScene(leftrect)
self.rightscene = TEMDrawer.DiagramScene(rightrect)
self.leftview.setScene(self.leftscene)
self.rightview.setScene(self.rightscene)
To copy to clipboard, switch view to plain text mode
The constructor of the DiagramScene calls the setSceneRect with the given parameter.
No GUI-related stuff other than that happens in the DiagramScene class.
Removing the setFixedSize() method calls do not enable automatic stretching of the QGraphicsView or QGraphicsScene.
Is there a way to automatically stretch a QGraphicsScene or QGraphicsView to fit the space the layout uses?
Thanks in advance!
PS: I had a look at the proposed threads #1#2#3, but they did not offer a solution for my problem...
Bookmarks