PDA

View Full Version : When does show a window?



avis_phoenix
7th September 2011, 00:45
I Use Qt 4.7.4

I have a widget inside a QMainWindow (central widget)
How I can know when finished display the window?

I need to load data but these data depend on the space you have QGraphicsView, I need to load data but these data depend on the space you have QGraphicsView, I load the data window after the show ended.

Thanks

ChrisW67
7th September 2011, 01:30
You can cause processing to be done when the event loop is reached (which is where any pending window painting will happen) by using a single shot timer in your constructor. see How can i check if QMainWindow is fully loaded ?

At least I think that is what you were after.

wysota
7th September 2011, 21:06
If Chris is wrong and you want to do something after the widget is shown, you can override showEvent() for your widget, and post an event, start a singleshot 0 timeout timer or use QMetaObject::invokeMethod() with Qt::QueuedConnection to trigger code execution after the control returns to the event loop after the widget is shown. Just make sure you don't execute the code each time the widget is shown.