qt - How to proper use QCommandLineOption? -
how should use commandlineoption process command line arguments when arguments defined in string? example, if argument "p ttt" want 1 thing, if "p mmmm" need else. little test show nothing in debug. misunderstanding usage of these classes?
#include <qcoreapplication> #include <qcommandlineoption> #include <qcommandlineparser> #include <qdebug> int main(int argc, char *argv[]) { qcoreapplication a(argc, argv); qcommandlineparser parser; qcommandlineoption co({{"p","pp","t"}, "test option", "v1"}); parser.addoption(co); parser.process ( (qstringlist() << "p --v1")); qstring vv = parser.value("p"); qdebug() << vv; return a.exec(); }
Comments
Post a Comment