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
Forum Update on Monday, May 27th 2025

Problem about argument of console app

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 259 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 1 Oct 2018, 09:44 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
    • V Offline
      V Offline
      VRonin
      wrote on 1 Oct 2018, 09:47 last edited by VRonin 10 Jan 2018, 09:48
      #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 1 Oct 2018, 10:31 last edited by aha_1980 10 Jan 2018, 10:48
        #3

        I setup addOptions and addPositionArgument after.
        Thanks so much!

        1 Reply Last reply
        0

        1/3

        1 Oct 2018, 09:44

        • Login

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