[Qt-interest] Executing code after QApplication::exec() without user intervention

Guido Seifert wargand at gmx.de
Tue Apr 27 19:21:20 CEST 2010


Don't quite understand the question. But from the description of your
requirement I'd do something like that:

	QApplication app(argc, argv,false);
        <instantiate arbitrary class>
        app.exec();

In your arbitrary classes' constructor you put all the stuff
you want to have done automatically, e.g. open a file from
command-line.

Regards,
Guido


> I'm sure there's some obvious solution to this, but my brain seems stuck :P
> 
> How do have a method executed automatically after the main event loop 
> (app->exec()) has started?  This is for the case where the application 
> takes a command-line argument to open a file.  Right now, this is simply 
> done the usual way, through the application's "File->Open" menu.  But 
> providing a filename as a command-line arg means I need to open the file 
> without user intervention.



More information about the Qt-interest-old mailing list