[Qt-interest] Updating Window Geometry on a widget being hidden

Josh jnfo-c at grauman.com
Mon Aug 2 21:56:36 CEST 2010


Hello all,

This should be really easy, but for some reason I can't figure it out. I'd 
appreciate what I imagine is a simple pointer...

I have some code that gets called in response to user input (ie clicking a 
button). This code hides a widget on the main window, and then needs to do 
some calculations based on the new window geometry (when the widget is 
hidden, the other widgets resize). Unfortunately, I haven't figured out 
how to synchronously force the window geometry to update so it is all 
correct in my doGeometryCalculations() function. Adding a spin loop around 
qApp->processEvents() makes it work, so I know everthing else is ok, but 
just can't figure out how to force all the geometry to update. Thanks!

Josh


   mainWin->widget->hide();
   mainWin->update(); // I also tried  mainWin->updateGeometry(); mainWin->repaint();
//for(int i=0;i<99;i++) //with spin loop it works, but I want to do correctly without spin loop
   qApp->processEvents();
   doGeometryCalculations();




More information about the Qt-interest-old mailing list