weevil
19th June 2010, 10: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?
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?