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. Problem about argument of console app

Problem about argument of console app

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 254 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.
  • K Offline
    K Offline
    Kien Bui
    wrote on last edited by
    #1
    parser.parse(appArgs);
    const QStringList args = parser.positionalArguments();
    

    input:
    ./app arg1 -a opt1 => args = arg1, opt1
    ./app arg -a opt1 arg1 => args = opt1, arg1

    but I need: args only has the argument without the value of the option.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      Can you show what you set up with QCommandLineParser::addOptions/QCommandLineParser::addPositionalArgument?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3
      • K Offline
        K Offline
        Kien Bui
        wrote on last edited by aha_1980
        #3

        I setup addOptions and addPositionArgument after.
        Thanks so much!

        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