Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78454

QCommandLineParser does not allow overriding the default executable in generated help

    XMLWordPrintable

Details

    • User Story
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.1
    • Core: Other
    • None
    • Linux

    • Linux/Wayland

    Description

      QCommandLineParser automatically generates help string when addHelpOption() is used. However the generated usage line with executable is not customizable and automatically display the full path to binary, which does not look nice:

      Usage: /home/userA/git/build-kjut-Desktop_Qt_5_12_0_GCC_64bit2-Debug/bin/visualizer.exe [options]

      Options:
      -h, --help      Displays this help.
      -v, --version   Displays version information.
      ...

      There is currently no way to customize the "Usage: ..." line, except for manually generating the complete help message from QString.

      It would be nice to have a method similar to setApplicationDescription(const QString&), e.g. setApplicationExecutable(const QString&) that will allow for overriding the default generated executable path, i.e. for the above example:

      parser.setApplicationExecutable("visualizer");
      parser.addHelpOption();

      will result in the following help text:

      Usage: visualizer [options]

      Options:
      -h, --help      Displays this help.
      -v, --version   Displays version information.
      ...

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dfaure_kdab David Faure
            ediap Adam Piatyszek
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes