Unsolved QCommandLineParser exit on parse()
-
Hi Folks,
can anybody tell me, what's the right way for using QCommandLineParser?
I tried this:
QCommandLineParser _parser;
_parser.addHelpOption();
qDebug() << _parser.addOption(QCommandLineOption(QStringList() << "p" << "port"));
_parser.process(QCoreApplication::arguments());I start the debugger with this simple command line option: --port=65000 and I'm getting back "Unexpected value after '--port' "
What did I wrong?
Regards,
Norbert -
Replace = by a blank: --port 65000
-
I tested "--port 65000", parse() has been done without exit, but calling "_parser.value("port")" is empty. It seems, that I cannot put value via the command line option.
-
You can, check the example in the documentation: http://doc.qt.io/qt-5/qcommandlineparser.html
-
Hi,
well, I think, I isoleted something:
- if I'm using the examples, and create an option: QCommandLineOption port(QStringList() << "p" << "port", "Write generated data into <file>.", "file"); it works well.
- if I create the option by this way: QCommandLineOption port("port", "declare port");, than the application exits.
Any other things are stayed unchanged.
-
Hi,
Can you show your complete parser related code ?