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. Cant get QCommandLineParser to ... parse

Cant get QCommandLineParser to ... parse

Scheduled Pinned Locked Moved Solved General and Desktop
qcommandlinepar
3 Posts 2 Posters 545 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.
  • D Offline
    D Offline
    Dariusz
    wrote on last edited by
    #1

    Hey

    I'm lost heres my code +/-

    QCommandLineParser parser;
    parser.setApplicationDescription("test App");
    parser.addHelpOption();
    parser.addVersionOption();
    parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
    
    QCommandLineOption argTEst(QStringList() << "lala" << "ohDearNuggets", "testStuff");
    
    parser.addOption(argTEst);
    parser.process(app);
    
    if (parser.isSet(argTEst)) {
        qDebug()<< parser.value(argTEst);
    }
    qDebug() << parser.optionNames() << parser.positionalArguments();
    

    This always print empty, I can see a valid argument in optionNames()/positionalArguments... But it never return the value when asked...

    I start app via app.exe -lala tralalalal

    What am I doing wrong here...

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #3

      See the documentation: "In addition, the valueName needs to be set if the option expects a value. "

      1 Reply Last reply
      2
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2
        This post is deleted!
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #3

          See the documentation: "In addition, the valueName needs to be set if the option expects a value. "

          1 Reply Last reply
          2

          • Login

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