QCommandLineParser exit on parse()
can anybody tell me, what's the right way for using QCommandLineParser?
I tried this:
qDebug() << _parser.addOption(QCommandLineOption(QStringList() << "p" << "port"));
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?
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
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.
Can you show your complete parser related code ?