QCommanlineparser gives allways empty values



  • I will not produce an error if the commandline is wrong. Therefore I cannot use
    QCommandlineParser::process and must use parse(QStringList)

    QStringList Argv;
    for(int i=0; i<argc; ++i)
    Argv<<argv[i];

    I want read this commandline
    --UserDir=xxxx

    QCommandLineOption o("UserDir");
    Parser.addOption(o);
    bool error=Parser.parse(Argv); // true
    bool ok=Parser.isSet(o); // true
    QString ss=Parser.value(o); // ""

    I get alway a empty value!

    PS: With process I get the an empty string, too.



  • Running this on windows? On UNIXes this could work on windows you will never get any output. Tiled, a program which uses Qt has the same problem: https://github.com/bjorn/tiled/issues/953



  • @jjan
    I work on Windows.
    The argv ist correct submitted to the app. The problem is the CommandLineParser or a stupid error of me I cant find.
    I had decided to make my own parser - it is a simple task.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.