QCommandLineOption Class

The QCommandLineOption class defines a possible command-line option. More...

Header: #include <QCommandLineOption>
qmake: QT += core
Since: Qt 5.2

This class was introduced in Qt 5.2.

Public Types

enum Flag { HiddenFromHelp, ShortOptionStyle }

Detailed Description

This class is used to describe an option on the command line. It allows different ways of defining the same option with multiple aliases possible. It is also used to describe how the option is used - it may be a flag (e.g. -v) or take a value (e.g. -o file).

Examples:

 QCommandLineOption verboseOption("verbose", "Verbose mode. Prints out more information.");
 QCommandLineOption outputOption(QStringList() << "o" << "output", "Write generated data into <file>.", "file");

See also QCommandLineParser.

Member Type Documentation

enum QCommandLineOption::Flag

ConstantValueDescription
QCommandLineOption::HiddenFromHelp0x1Hide this option in the user-visible help output. All options are visible by default. Setting this flag for a particular option makes it internal, i.e. not listed in the help output.
QCommandLineOption::ShortOptionStyle0x2The option will always be understood as a short option, regardless of what was set by QCommandLineParser::setSingleDashWordOptionMode. This allows flags such as -DDEFINE=VALUE or -I/include/path to be interpreted as short flags even when the parser is in QCommandLineParser::ParseAsLongOptions mode.

See also QCommandLineOption::setFlags() and QCommandLineOption::flags().