From 46f5596e5966ce79da2ebae73ea3bec69eef60ae Mon Sep 17 00:00:00 2001 From: Toni Spets Date: Thu, 25 Feb 2021 06:10:13 +0200 Subject: [PATCH] Initialize Application before parser arguments (#6177) Co-authored-by: Jonathan White --- src/main.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 80884562e..20359b1af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -56,6 +56,12 @@ int main(int argc, char** argv) #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && defined(Q_OS_WIN) QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); #endif + Application app(argc, argv); + // don't set organizationName as that changes the return value of + // QStandardPaths::writableLocation(QDesktopServices::DataLocation) + Application::setApplicationName("KeePassXC"); + Application::setApplicationVersion(KEEPASSXC_VERSION); + app.setProperty("KPXC_QUALIFIED_APPNAME", "org.keepassxc.KeePassXC"); QCommandLineParser parser; parser.setApplicationDescription(QObject::tr("KeePassXC - cross-platform password manager")); @@ -83,13 +89,6 @@ int main(int argc, char** argv) parser.addOption(allowScreenCaptureOption); } - Application app(argc, argv); - // don't set organizationName as that changes the return value of - // QStandardPaths::writableLocation(QDesktopServices::DataLocation) - Application::setApplicationName("KeePassXC"); - Application::setApplicationVersion(KEEPASSXC_VERSION); - app.setProperty("KPXC_QUALIFIED_APPNAME", "org.keepassxc.KeePassXC"); - parser.process(app); // Exit early if we're only showing the help / version