From ca328242bce505e0d3e53914ecbbaa4350b9dbfd Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 8 Oct 2018 17:29:08 +0100 Subject: [PATCH] Don't show application if we're only showing the help / version --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 687988762..903974fa7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,7 +95,7 @@ int main(int argc, char** argv) QCoreApplication::translate("main", "Parent window handle"), "handle"); - parser.addHelpOption(); + QCommandLineOption helpOption = parser.addHelpOption(); QCommandLineOption versionOption = parser.addVersionOption(); parser.addOption(configOption); parser.addOption(keyfileOption); @@ -103,6 +103,12 @@ int main(int argc, char** argv) parser.addOption(parentWindowOption); parser.process(app); + + // Don't try and do anything with the application if we're only showing the help / version + if (parser.isSet(versionOption) || parser.isSet(helpOption)) { + return 0; + } + const QStringList fileNames = parser.positionalArguments(); if (app.isAlreadyRunning() && !parser.isSet(versionOption)) {