Results 1 to 13 of 13

Thread: Question on proper use of QCommandLineOption?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Question on proper use of QCommandLineOption?

    Sure, a typical usage would be:
    Qt Code:
    1. tablesync -i -c test.csv -t incident_data ~/db/sqlite.db
    To copy to clipboard, switch view to plain text mode 
    Here's also the "tablesync -h" output that is automatically built:
    Qt Code:
    1. mbp02:~/develop/tablesync[develop]$ tablesync -h
    2. Usage: tablesync [options] db
    3.  
    4. Options:
    5. -h, --help Displays this help.
    6. -v, --version Displays version information.
    7. -c, --csvfile <csvfile> The CSV file with desired fields.
    8. -i, --import Import the CSV file into tablename
    9. -s, --sync Sync tablename with the CSV file fields.
    10. -t, --table <tablename> The target table name.
    11.  
    12. Arguments:
    13. db The database file to process.
    To copy to clipboard, switch view to plain text mode 

    As shown above, the only positional argument is the last, so that requires that all cmd line options that start with a "-" must precede any positional arguments. The Qt behavior with QCommandLineParser seems pretty sane/normal to me, so I'm quite happy to use it rather than have to deal with the differences between getopt(s) on different OS platforms, etc.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  2. The following user says thank you to jefftee for this useful post:

    TorAn (11th November 2016)

Similar Threads

  1. Proper file downloading?
    By matt4682 in forum Newbie
    Replies: 4
    Last Post: 2nd May 2014, 10:45
  2. Proper way to use qmake and moc?
    By mossen in forum Newbie
    Replies: 1
    Last Post: 6th May 2011, 02:52
  3. proper use of QList?
    By jhowland in forum Qt Programming
    Replies: 3
    Last Post: 13th September 2010, 14:57
  4. Need help determining proper Qt distribution
    By bizmopeen in forum Newbie
    Replies: 2
    Last Post: 22nd December 2009, 20:47
  5. Proper way to #include Qt?
    By pherthyl in forum Qt Programming
    Replies: 1
    Last Post: 11th August 2006, 02:15

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
  •  
Qt is a trademark of The Qt Company.