PDA

View Full Version : MainWindow won't resize, why does this work?



weevil
19th June 2010, 11:09
I have a reimplementation of QMainWindow, whose contents change size dynamically. When they shrink, I can't get MainWindow to shrink along with them. When I manually adjust the size of the window, it automatically snaps to the right size, but no combination of setGeometry(), resize(), adjustSize() or fiddling with size policies and size hints has worked. I fumbled across a solution by calling:


hide();
showMinimized();
show();
showNormal();

QResizeEvent *event = new QResizeEvent( QSize(0,0), QSize(0,0) );
QCoreApplication::sendEvent( this, event );

which works.. but obviously isn't ideal. And I'm not quite sure why it works. Anyone have any thoughts?

tbscope
20th June 2010, 08:08
Most likely you have overridden something in your main window.
Post the complete code of the main window