Obtaining command line arguments in a QT console app
Posted
by morpheous
on Stack Overflow
See other posts from Stack Overflow
or by morpheous
Published on 2010-05-27T03:54:16Z
Indexed on
2010/05/27
4:01 UTC
Read the original article
Hit count: 202
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
© Stack Overflow or respective owner