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

Mihail Naydenov mlists at ymail.com
Tue Apr 27 08:34:28 CEST 2010


You dont do this after exec(), you do it before it.

You can query QApplication for arguments (QApplication::arguments()),
do what you have to do "without user intervention".
When done - start the exec().

If you need some data form the "without user intervention" part - store it, or a ref to it in the controls you use.
Later after exec() you can clean it if you have to.
bool result = a.exec();
...clean...
return result;
OR connect to QApplication::aboutToQuit()

Thats it in general. You have to supply more concrete example if this answer does not work for you.
MihailNaydenov



----- Original Message ----
> From: Nikos Chantziaras <realnc at arcor.de>
> To: qt-interest at trolltech.com
> Sent: Tue, April 27, 2010 9:00:15 AM
> Subject: [Qt-interest] Executing code after QApplication::exec() without user intervention
> 
> 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.
_______________________________________________
Qt-interest 
> mailing list

> href="mailto:Qt-interest at trolltech.com">Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


      



More information about the Qt-interest-old mailing list