qt5base-lts/tests/auto/corelib/tools/qcommandlineparser
Marc Mutz 7f78d547ca QCommandLineParser: support extremely concise option configuration in C++11
The goal of this commit to make the code in the test work:

    QCommandLineParser parser;
    parser.addOptions({
        { "a",                "The A option." },
        { { "v", "verbose" }, "The verbose option." },
        { { "i", "infile" },  "The input file.", "value" },
    });

For this, QCommandLineParser needs a version of addOption that can
take a list of options. That's what addOptions() is for.

More importantly, the QCommandLineOption ctors mustn't be explicit.
OTOH, any implicit conversion from QString or QStringList to
QCommandLineOption is also undesirable.

To solve this dilemma, add new QCommandLineOption ctors that just
take one argument and are explicit, and make the existing ctors
implicit. In order to avoid ambiguities, remove the default values
of their resp. 2nd arguments. The new ctors are by intention not
\since 5.4, as they are completely transparent to the user.

Et voila, even better than getopt_long(3).

[ChangeLog][QtCore][QCommandLineParser] Added addOptions() method.

Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-08-06 22:17:22 +02:00
..
testhelper QCommandLineParser: add word-wrapping algorithm 2013-11-17 00:45:03 +01:00
qcommandlineparser.pro Long live QCommandLineParser! 2013-08-24 21:33:39 +02:00
tst_qcommandlineparser.cpp QCommandLineParser: support extremely concise option configuration in C++11 2014-08-06 22:17:22 +02:00
tst_qcommandlineparser.pro Long live QCommandLineParser! 2013-08-24 21:33:39 +02:00