5

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.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
laurent
  • 88,262
  • 77
  • 290
  • 428
  • 1
    Some months ago I was thinking about the same question. Still wondering... – totymedli Dec 11 '12 at 03:50
  • The unity tag is for Microsoft Unity. Please don't misuse it. – Lex Li Dec 15 '12 at 06:05
  • Have you solved it? I'm trying also to set up an icon for my pyside2 application with setWindowIcon but it still displays the questions mark in unity desktop. Not sure if it works for gnome. – Blind0ne Dec 07 '20 at 14:31

2 Answers2

0

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.

Ruslan F.
  • 5,498
  • 3
  • 23
  • 42
0

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.

Community
  • 1
  • 1
Frank Osterfeld
  • 24,815
  • 5
  • 58
  • 70
  • I'm familiar with .desktop files, but what if I want to dynamically change the icon at runtime using `setWindowIcon`. Is it disabled on Unity? Would using a desktop file actually help? – laurent Dec 13 '12 at 00:55