JayKemper
4th March 2020, 00:59
I'm trying to parse the following command line input:
./qtProgram --arguments first second third
I've looked at the documentation for QCommandLineParser and the provided example, but they only address when the command line argument has one value.
There is a QCommandLineParser function called "values" that returns a QStringList, which looked promising, but it only returns a list of one (and it's "first"). How do I set up the QCommandLineOption to pull all of them into a QStringList?
...
QCommandLineOption argumentOption(QStringList() << "a" << "arguments",
"Parse the following arguments <arguments>.",
"none");
parser.addOption(argumentOption);
...
QStringList argumentList = parser.values(argumentOption); // Size is one, value is "first"
./qtProgram --arguments first second third
I've looked at the documentation for QCommandLineParser and the provided example, but they only address when the command line argument has one value.
There is a QCommandLineParser function called "values" that returns a QStringList, which looked promising, but it only returns a list of one (and it's "first"). How do I set up the QCommandLineOption to pull all of them into a QStringList?
...
QCommandLineOption argumentOption(QStringList() << "a" << "arguments",
"Parse the following arguments <arguments>.",
"none");
parser.addOption(argumentOption);
...
QStringList argumentList = parser.values(argumentOption); // Size is one, value is "first"