I am running a small app on KDE Plasma 5 created with Qt and the KDE framework. Almost everything works like a charm, just one part doesn't work. I just cannot set the application display name. I have the following code:
int main(int argc, char **argv) { QApplication application(argc, argv); KLocalizedString::setApplicationDomain("blender-render-control"); KCrash::initialize(); KAboutData aboutData(QStringLiteral("blender-render-control-center"), i18n("Blender Render Control Center"), QStringLiteral("1.0"), i18n("A simple application to control the blender render control server"), KAboutLicense::Custom, i18n("Copyright 2019, Knerd ")); aboutData.addAuthor(i18n("Knerd"), i18n("Author"), QStringLiteral("knerd@knerd.knerd")); aboutData.setOrganizationDomain("knerd.knerd"); aboutData.setDesktopFileName(QStringLiteral("knerd.knerd.blender-render-control")); KAboutData::setApplicationData(aboutData); QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("knerd.knerd.blender-render-control"))); application.setApplicationDisplayName(i18n("Blender Render Control Center")); application.setApplicationName(i18n("Blender Render Control Center")); QCommandLineParser parser; aboutData.setupCommandLine(&parser); parser.process(application); aboutData.processCommandLine(&parser); auto *window = new MainWindow(); window->show(); return QApplication::exec(); }
From reading the docs and checking some examples, this should set the application title in my KDE environment. But it doesn't, the application name is the name of the executable.
Is this a bug in KDE or am I doing something wrong?
The docs are a bit confusing on what the applicationName and displayApplicationName are actually used for, there has been some bug reports about it, and behavior has changed between versions if I remember correcly.
If you want a window-title, I think you can do.
window->setWindowTitle( QCoreApplication::applicationName() );