简体   繁体   English

为什么我的Qt应用程序会忽略applicationDisplayName的设置?

[英]Why does my Qt app ignore the setting of applicationDisplayName?

I am running a small app on KDE Plasma 5 created with Qt and the KDE framework. 我正在使用Qt和KDE框架创建的KDE Plasma 5上运行一个小型应用程序。 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. 通过阅读文档并检查一些示例,这应该在我的KDE环境中设置应用程序标题。 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? 这是KDE中的错误,还是我做错了什么?

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. 这些文档对于applicationName和displayApplicationName的实际用途有些困惑,有一些关于它的错误报告,并且如果我记得的话,版本之间的行为也有所变化。

If you want a window-title, I think you can do. 如果您想要窗口标题,我想您可以。

window->setWindowTitle( QCoreApplication::applicationName() );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的Android设备上的Qt应用程序不支持utf-8字符 - Why does not Qt app on my android device support utf-8 characters 为什么当我想在我的 Qt 应用程序上打开第二个 window 时,我的 header 文件无法识别第二个 window? - Why while i want to open a second window on my Qt app, my header file does not recognize the second window? 为什么我的 Qt 4.5 应用程序会在 Windows 下打开一个控制台窗口? - Why does my Qt 4.5 app open a console window under Windows? 为什么从Qt应用程序上的命令行运行IncrediBuild永不停止? - Why does running IncrediBuild from the command line on my Qt app never halt? 当我不使用任何GUI库时,为什么我的Qt应用程序需要libQt5Gui.so.5? - Why does my Qt app need libQt5Gui.so.5 when I don't use any GUI libs? 为什么我的 Qt 程序在断言失败后继续运行? - Why does my Qt program keeps running after assertion failure? 为什么我的 Qt 应用程序在使用 NoMachine 时看起来不一样 - Why does my Qt application appear different when using NoMachine 为什么 Qt Webassembly 应用程序启动时间过长? - Why does Qt Webassembly app start too long? 为什么我的 Qt 程序中未执行的代码会导致程序崩溃? - Why does the unexecuted code in my Qt program cause the program to crash? 我的应用程序“ Qt”可以在计算机上运行,​​但不能在朋友的计算机上运行 - My app 'Qt' runs in my computer but does not run on my friend's
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM