Support --option in addition to -option for all builtin Qt commandline options.

In addition to being more common and consistent with QCommandLineParser, this
will make it possible to add the documentation for these options
in the QCommandLineParser-generated help output.

[ChangeLog][General] Builtin command-line options such as -reverse,
-session, -style etc. now all support double dash, e.g. --reverse,
--session, --style...

Change-Id: Ia2e22c854ccc6a9d7b863b1234317005bc822191
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
David Faure 2014-01-31 09:49:58 +01:00 committed by The Qt Project
parent c8848a5e98
commit 9db6c67f5c
4 changed files with 17 additions and 13 deletions

View File

@ -186,6 +186,8 @@ void QCoreApplicationPrivate::processCommandLineArguments()
continue;
}
QByteArray arg = argv[i];
if (arg.startsWith("--"))
arg.remove(0, 1);
if (arg.startsWith("-qmljsdebugger=")) {
qmljs_debug_arguments = QString::fromLocal8Bit(arg.right(arg.length() - 15));
} else if (arg == "-qmljsdebugger" && i < argc - 1) {

View File

@ -1018,6 +1018,8 @@ void QGuiApplicationPrivate::createPlatformIntegration()
continue;
}
QByteArray arg = argv[i];
if (arg.startsWith("--"))
arg.remove(0, 1);
if (arg == "-platformpluginpath") {
if (++i < argc)
platformPluginPath = QLatin1String(argv[i]);
@ -1098,6 +1100,8 @@ void QGuiApplicationPrivate::init()
continue;
}
QByteArray arg = argv[i];
if (arg.startsWith("--"))
arg.remove(0, 1);
if (arg == "-plugin") {
if (++i < argc)
pluginList << argv[i];

View File

@ -145,18 +145,15 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
if (argc) {
int j = 1;
for (int i = 1; i < argc; i++) {
char *arg = argv[i];
if (arg) {
if (!strcmp(arg, "-display") && i < argc - 1) {
displayName = argv[++i];
arg = 0;
} else if (!strcmp(arg, "-name") && i < argc - 1) {
m_instanceName = argv[++i];
arg = 0;
}
}
if (arg)
argv[j++] = arg;
QByteArray arg(argv[i]);
if (arg.startsWith("--"))
arg.remove(0, 1);
if (arg == "-display" && i < argc - 1)
displayName = argv[++i];
else if (arg == "-name" && i < argc - 1)
m_instanceName = argv[++i];
else
argv[j++] = argv[i];
}
argc = j;
} // argc

View File

@ -446,7 +446,8 @@ void QApplicationPrivate::process_cmdline()
continue;
}
QByteArray arg = argv[i];
arg = arg;
if (arg.startsWith("--"))
arg.remove(0, 1);
QString s;
if (arg == "-qdevel" || arg == "-qdebug") {
// obsolete argument