Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCommanlineparser gives allways empty values
QtWS25 Last Chance

QCommanlineparser gives allways empty values

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 737 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by Andy314
    #1

    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.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jjan
      wrote on last edited by
      #2

      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

      Andy314A 1 Reply Last reply
      0
      • J jjan

        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

        Andy314A Offline
        Andy314A Offline
        Andy314
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved