check for program_invocation_short_name variable and use it in QCoreApplication::setApplicationName() if available

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-14 09:32:18 +03:00
parent c23499cb2a
commit 212ea37257
2 changed files with 6 additions and 0 deletions

View 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")

View 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());