Obtaining command line arguments in a QT console app
- by morpheous
The following snippet is from a little console app I wrote using the QT framework. Currently, it does not receive the arguments passed at the CLI.
Can anyone spot what I may be doing wrong?
int main(int argc, char *argv[])
{
//Q_INIT_RESOURCE(application);
try {
QApplication the_app(argc, argv);
utility::option_values ov;
QStringList cmdline_args = QCoreApplication::arguments();
//attempt to parse arguments here, but cmdline_args is an empty list :(
ov.parse_options(cmdline_args);
// Code continues ...
}
} catch (utility::invalid_option&) {
return 1;
}
return 0;
}
I am debugging using QtCreator 1.3