Results 1 to 3 of 3

Thread: Problem about argument of console app

  1. #1
    Join Date
    May 2018
    Posts
    19
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Problem about argument of console app

    I used QCommandLineParser to parse app's agrument
    Qt Code:
    1. QCommandLineParser parser;
    2. parser.parse(qApp->arguments());
    3. const QStringList args = parser.positionalArguments();
    To copy to clipboard, switch view to plain text mode 
    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.
    Last edited by madawg; 1st October 2018 at 12:26.

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    503
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem about argument of console app

    Hi, do you use QCommandLineParser?

    Ginsengelf

  3. #3
    Join Date
    May 2018
    Posts
    19
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem about argument of console app

    Sure. I will edit question.


    Added after 12 minutes:


    I setup addOptipns and addPositionArgument after.
    Thanks so much!
    Last edited by madawg; 1st October 2018 at 12:36.

Similar Threads

  1. Replies: 1
    Last Post: 3rd May 2013, 17:07
  2. Replies: 1
    Last Post: 6th April 2011, 00:23
  3. Problem with Qt console
    By Nishant in forum Installation and Deployment
    Replies: 3
    Last Post: 15th October 2009, 13:05
  4. Replies: 11
    Last Post: 3rd September 2007, 18:28
  5. Console Program Problem
    By ball in forum Qt Programming
    Replies: 9
    Last Post: 28th May 2006, 10:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.