c++ - Qt QWidget::minimumSizeHint delay (#2) -
when hide widget in application, minimumsizehint isn't updated immediatly.
i tried qlayout::activate() solution suggested @ this post, doesn't work me because qlayout::activate() returns false.
i try @ mainwindow class this:
ui.groupbox->setvisible(!ui.groupbox->isvisible()); qdebug() << this->layout()->activate(); qdebug() << this->minimumsizehint(); this->resize(this->minimumsizehint()); any ideas why it's not working?
my current workaround is:
qtimer::singleshot(10, this, slot(on_resizemin())); but noticed 10ms may not enough on slow system. nasty workaround.
the size hints meant used @ appropriate moments layout system. you're not supposed using them elsewhere - that's why appear "not work".
you appear want constrain size of main widget (the window) 1 of size hints. you'll need set appropriate sizeconstrainton widget's layout. there 2 approaches:
use
qlayout::setfixedsizeconstraint. reimplement layout'ssizehintreturnminimumsize, suchqlayout::setfixedsizeset window's size minimum size hint, not default size hint.patch qt implement
qlayout::setminandmaxtominsize, meaning "the main widget's minimum and maximum size setminimumsize()"the patch small :)
Comments
Post a Comment