I would like to execute a method which can only be called once my QApplication is displayed, i.e. when it has entered its main event loop exec_(). I'm new to Qt4 (using PyQt4): i was hoping to have a on_start()-like callback, but didn't find one.
Do i need to create a thread or a timer? Or is there some callback included in the API already?
I haven't used Qt before, so I might be wrong on this, but I imagine you could bind your on_start() method to the ApplicationActivate event, and set a flag from inside your on_start() method so that the code would only be run that very first time and not any other times the ApplicationActivate event is triggered during execution of your program.
On the other hand if the on_start() method would be called by multiple threads, you might want to use thread-specific flags. Haven't done much multithreading myself, so I'm not sure of what the specifics for that would be, or how simple/complicated it would be.
How to execute a method automatically after entering Qt event loop?