PDA

View Full Version : (GUI) how to run code on program startup



qtierer
9th May 2011, 19:45
hi,
how can i make a piec of code to run when the GUI application starts?
i see no onStart signal or something like that in Qt.

thanks in advance.

Zlatomir
9th May 2011, 19:56
I guess it depends what are you trying to do, you can just call a function (code you want to run) from main before you start the event-loop (if your code doesn't need the event loop, or signal-slot, or other things that need the event loop), or you can call some function from the constructor of your main window and i guess there might be many other ways.

qtierer
9th May 2011, 20:15
thanks,
i put my code into
MainWindow::MainWindow(QWidget *parent) :

and it worked like i wanted.