سؤال

I'm trying to get my Qt application to display an icon in the Unity Launcher but it's not working. In code, I'm simply using:

qApp->setWindowIcon(QIcon("path/to/icon.png"));

but it's not doing anything. I've also tried setting the icon directly on the main window but it doesn't help either.

Any idea what could be the issue?

PS: I've checked the icon path and it is correct.

هل كانت مفيدة؟

المحلول

Without knowing the details of unity, I'm pretty sure that you'll have to create and install a .desktop file with the icon in it. See for example here. Whatever you set at runtime, the launcher cannot know about before starting the application, so it will need the information from an external configuration.

نصائح أخرى

To enable picture encoding in Windows(not in Ubuntu) I've put the QT\4.8.3\plugins\imageformats folder near my app. I think You should try the same.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top