You could start your loop with a slot. Something like this:
int main(int argc, char *argv[])
{
CLIClient *client = new CLIClient;
QTimer::singleShot(0, client,
SLOT(run
()));
return app.exec();
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
CLIClient *client = new CLIClient;
QTimer::singleShot(0, client, SLOT(run()));
return app.exec();
}
To copy to clipboard, switch view to plain text mode
So your run() function will be called as soon as the Qt event loop starts. Of course CLIClient must be a QObject (or you can wrap it with a QObject).
Anyway, if your main loop does not ever return until the end of the program you will still have some problems, because the Qt event loop will not be executed until then.
Bookmarks