summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcommandlineoption.cpp
diff options
context:
space:
mode:
authorKaloyan Chehlarski <kaloyan.chehlarski@qt.io>2024-08-23 14:24:24 +0200
committerDavid Faure <david.faure@kdab.com>2024-08-27 00:41:54 +0000
commit61e91cb2812a2ba63354dbfb7a1fb4debcfcbe9e (patch)
tree1e02cbbe95906d22ff3fff63489e8003216f202c /src/corelib/tools/qcommandlineoption.cpp
parent8a0c86651f1e5091c4fb5ef8cbbcef53a9e336eb (diff)
QCommandLineParser: Support ignoring input past a certain option
This change adds a new flag to QCommandLineOption to indicate that any command line options that follow are to be ignored by QCommandLineParser. When an option with that flag is parsed, any subsequent options are immediately skipped, and the parser will return true, indicating success. This is motivated by Qt WebEngine's need for being able to pass through command line options from the host application to the underlying Chromium. This is done by using the --webEngineArgs option, which separates the Qt application options (on the left), and the Chromium ones (on the right). With this change, this mechanism will no longer clash with QCommandLineParser's behavior of shutting the app down when encountering an unknown option. Change-Id: I31aedb7a18e551def742891623604513a329d7ca Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/tools/qcommandlineoption.cpp')
-rw-r--r--src/corelib/tools/qcommandlineoption.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp
index 6b990cecf17..5d8f089d5b9 100644
--- a/src/corelib/tools/qcommandlineoption.cpp
+++ b/src/corelib/tools/qcommandlineoption.cpp
@@ -389,6 +389,10 @@ void QCommandLineOption::setFlags(Flags flags)
interpreted as short flags even when the parser is in
QCommandLineParser::ParseAsLongOptions mode.
+ \value IgnoreOptionsAfter [since 6.9] No options beyond this one will be parsed. Useful
+ for cases where you need to send extra command line arguments to a secondary
+ application. If a value is provided for this option, it will be ignored.
+
\sa QCommandLineOption::setFlags(), QCommandLineOption::flags()
*/