From 63cb9c93a683df113ae41eeb81291859a20b7489 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 12 Aug 2026 19:21:58 +0000 Subject: [PATCH] Qt4: replace QGuiApplication::applicationDisplayName() setApplicationDisplayName()/applicationDisplayName() are part of QGuiApplication, which doesn't exist before Qt5 (Qt4's QApplication doesn't derive from it). Both call sites here always used the exact same value as applicationName() anyway (both set to APP_NAME), so: version-gate the setter (a no-op on Qt4 since applicationName already equals APP_NAME), and just use applicationName() for the getter unconditionally -- correct on every Qt version, not just Qt4. --- src/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 109e60d..a2a212d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -182,7 +182,12 @@ int main(int argc, char* argv[]) return 0; } } +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + /* QGuiApplication::setApplicationDisplayName() doesn't exist before + * Qt5; applicationName() (set above, also to APP_NAME) already + * covers the same need on Qt4. */ app.setApplicationDisplayName(APP_NAME); +#endif app.setQuitOnLastWindowClosed(false); if (QSystemTrayIcon::isSystemTrayAvailable()) { @@ -205,7 +210,10 @@ int main(int argc, char* argv[]) #endif auto fileLog = std::make_unique(); - Logger::instance().addMessage(QString("%1 (%2) logging started...").arg(app.applicationDisplayName()).arg(app.applicationVersion())); + /* applicationName(), not applicationDisplayName() (Qt5+ only): both + * are set to APP_NAME above wherever displayName exists, so they're + * always equal here anyway. */ + Logger::instance().addMessage(QString("%1 (%2) logging started...").arg(app.applicationName()).arg(app.applicationVersion())); gnutls_global_init(); #ifndef _WIN32 -- 2.43.0