OSDN Git Service

check for program_invocation_short_name variable and use it in QCoreApplication:...
authorIvailo Monev <xakepa10@gmail.com>
Tue, 14 Jun 2022 06:32:18 +0000 (09:32 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Tue, 14 Jun 2022 06:32:18 +0000 (09:32 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
CMakeLists.txt
src/core/kernel/qcoreapplication.cpp

index 2c51ca7..b7059c1 100644 (file)
@@ -352,6 +352,7 @@ katie_check_function(timegm "time.h")
 katie_check_function(pipe2 "unistd.h")
 katie_check_function(getdomainname "unistd.h")
 katie_check_function(renameat2 "stdio.h")
+katie_check_function(program_invocation_short_name "errno.h")
 katie_check_struct(tm tm_gmtoff "time.h")
 katie_check_struct(tm tm_zone "time.h")
 katie_check_struct(dirent d_type "dirent.h")
index ffd6265..a838fa7 100644 (file)
@@ -48,6 +48,7 @@
 #include "qstdcontainers_p.h"
 
 #include <stdlib.h>
+#include <errno.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -1568,6 +1569,10 @@ QString QCoreApplication::applicationName()
 {
     QString name = coreappdata()->application;
 
+#ifdef QT_HAVE_PROGRAM_INVOCATION_SHORT_NAME
+    name = QString::fromLocal8Bit(program_invocation_short_name);
+#endif
+
 #ifdef QT_HAVE_GETPROGNAME
     if (name.isEmpty()) {
         name = QString::fromLocal8Bit(::getprogname());