PDA

View Full Version : Event when application form has loaded? (onload)



AnAx
15th May 2010, 03:44
I would like to know when the QT application has finished loading so I can start doing some stuff.

I do not know if I'm thinking about this in the wrong way but I want to run a function when the application has finished loading and the only way I can think of is to make a connection between some event and my function but I do not seem to be able to find any good event for this.

Please advice.

(Qt 4.6, Windows, GUI app with one form)

Lykurg
15th May 2010, 07:18
Do you use threads? If not all function calls are proceed one after the other, so normally no "onload" is needed. E.g. after calling the constructor of your gui class simple call your other function and it behaves like you want.

AnAx
15th May 2010, 13:04
Do you use threads? If not all function calls are proceed one after the other, so normally no "onload" is needed. E.g. after calling the constructor of your gui class simple call your other function and it behaves like you want.

Yes, I use threads and the solution seems to be to start a thread in my constructor.

For some reason I do not find this solution to be as clean as it could be.
If I was not using threads then I would call a function, from the constructor, that would loop for the entire duration of the program.

SixDegrees
15th May 2010, 15:23
Your main widget/application is fully constructed and visible once the main show() function returns. See the QSplashScreen documentation for an example.

Not sure if this is exactly what you're looking for.