Clean up phrasing of --help-all and other help options

The options included by --help-all, although they are "specific to
Qt", are "specific" to all Qt applications, so - in the present
context, of QCommandLineParser - not specific at all. It's the options
described by -h that are specific, to the present command; the Qt
options are generic (in the present context).

So rework the help string for --help-all itself and the documentation
of the function. It had, in any case, an overly-complex first line,
that descended into too much detail. Updated test to match.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I06da0af41be60e6e1b7616984001ddb9ca33aad6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
bb10
Edward Welbourne 2023-05-03 14:39:07 +02:00
parent 56df9e5603
commit 526ce669ed
2 changed files with 11 additions and 6 deletions

View File

@ -389,13 +389,17 @@ QCommandLineOption QCommandLineParser::addVersionOption()
}
/*!
Adds the help option (\c{-h}, \c{--help} and \c{-?} on Windows)
as well as an option \c{--help-all} to include Qt-specific options in the output.
Adds help options to the command-line parser.
The options specified for this command-line are described by \c{-h} or
\c{--help}. On Windows, the alternative \c{-?} is also supported. The option
\c{--help-all} extends that to include generic Qt options, not defined by
this command, in the output.
These options are handled automatically by QCommandLineParser.
Remember to use setApplicationDescription to set the application description,
which will be displayed when this option is used.
Remember to use \c setApplicationDescription() to set the application
description, which will be displayed when this option is used.
Example:
\snippet code/src_corelib_tools_qcommandlineparser_main.cpp 0
@ -411,7 +415,8 @@ QCommandLineOption QCommandLineParser::addHelpOption()
<< QStringLiteral("h")
<< QStringLiteral("help"), tr("Displays help on commandline options."));
addOption(opt);
QCommandLineOption optHelpAll(QStringLiteral("help-all"), tr("Displays help including Qt specific options."));
QCommandLineOption optHelpAll(QStringLiteral("help-all"),
tr("Displays help, including generic Qt options."));
addOption(optHelpAll);
d->builtinHelpOption = true;
return opt;

View File

@ -553,7 +553,7 @@ void tst_QCommandLineParser::testVersionOption()
static const char expectedOptionsHelp[] =
"Options:\n"
" -h, --help Displays help on commandline options.\n"
" --help-all Displays help including Qt specific options.\n"
" --help-all Displays help, including generic Qt options.\n"
" -v, --version Displays version information.\n"
" --load <url> Load file from URL.\n"
" -o, --output <file> Set output file.\n"