I'm working with QCommandLineParser
but I'm not sure how to handle the defaultValue
of an option. This is the snippet I have so far:
QCommandLineParser parser;
parser.setApplicationDescription("Video Grabber and Streamer");
parser.addOption(QCommandLineOption("streaming.fps", "Frame rate for streaming. Default: 20", "fps", "20"));
parser.process(*QCoreApplication::instance());
As far as I've understood from the doc:
In addition, the valueName needs to be set if the option expects a value. The default value for the option is set to defaultValue.
I'm expecting that if --streaming.fps
option is not passed, the option will be present and set to 20
. But this does not happens; it works fine if I pass
myapp.exe --streaming.fps 10
parser.optionNames()
contains streaming.fps
and its value is 10. But if I run:
myapp.exe
Then parser.optionNames()
is empty.
Any suggestion?