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:

  1. use qlayout::setfixedsize constraint. reimplement layout's sizehint return minimumsize, such qlayout::setfixedsize set window's size minimum size hint, not default size hint.

  2. patch qt implement qlayout::setminandmaxtominsize, meaning "the main widget's minimum and maximum size set minimumsize()"

    the patch small :)


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -