I am trying to write a console-based QtCore application but am unable to figure out how to do so.
According to the documentation, QCoreApplication should be used for command-line apps.
I have the following code:
int main(int argc, char *argv[])
{
CLIClient *client = new CLIClient;
client.run();
return app.exec();
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
CLIClient *client = new CLIClient;
client.run();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
client.run() contains a while loop which never exits which drives the command-line interface. However, since app.exec() is never called I can't use QProcess and other QtCore components.
How can I use the QCoreApplication event loop which is alluded to in the documentation?
Bookmarks