Resizing a Qt main window when a contained widget changes its size
In PyQt4, I have a main window which sets as its central (开发者_C百科and only) widget a custom widget I created. Through user action, the widget can change its size. When this happens, I want the main window that contains the widget to adjust its size so that it conforms to the new size of its child widget. Unfortunately, this isn't happening. The new widget is created but it is forced to adapt to the main window's previous size. I have over-ridden the sizeHint method for the widget so that it returns the desired size but this appears to be ignored. I've also added a call to updateGeometry for both the widget and the main window but this has no affect either.
I'm pretty sure I'm close to getting this to work but I'm not terribly experienced in Qt's nuances. Can someone give me some guidance here?
精彩评论