genjix
30th October 2010, 22:20
I have a QGraphicsView and want to add a QTextEdit on top of that, which resizes with the whole window. I parent it to the view, instead of the scene since the text needs to remain the same size.
5413
http://www.qtcentre.org/attachment.php?attachmentid=5413&d=1288469631
def resizeEvent(self, event):
# .....
winSize = self.contentsRect().size()
winw, winh = winSize.width(), winSize.height()
self.chat.resize(winw*0.5, winh*0.5)
self.chat.move(10,winh*0.5)
At the moment I resize it manually in the resizeEvent, but it's ugly since when you resize it updates and when scrollbars appear, it becomes transparent and I don't know how to turn it off.
How should I be doing this?
It's as if the widget has no 'sense' of the size of the window. If I could attach another widget to the window layered on top of the QGraphicsView below then this could be easily be solved by using layouts.
window.setWidget(QGraphicsScene); window.setWidget2(interactableGui)
That sort of thing ;)
5413
http://www.qtcentre.org/attachment.php?attachmentid=5413&d=1288469631
def resizeEvent(self, event):
# .....
winSize = self.contentsRect().size()
winw, winh = winSize.width(), winSize.height()
self.chat.resize(winw*0.5, winh*0.5)
self.chat.move(10,winh*0.5)
At the moment I resize it manually in the resizeEvent, but it's ugly since when you resize it updates and when scrollbars appear, it becomes transparent and I don't know how to turn it off.
How should I be doing this?
It's as if the widget has no 'sense' of the size of the window. If I could attach another widget to the window layered on top of the QGraphicsView below then this could be easily be solved by using layouts.
window.setWidget(QGraphicsScene); window.setWidget2(interactableGui)
That sort of thing ;)