Qt5 Set application icon for Mac

icons, macos, qt, qt5

Solution

For what is worth, I have done exactly the same stuff as you with QT5 and it works.

Basically in my .pro file I have:

ICON = icon.icns

Moreover, I had to specify icon location in my app.plist file. Basically you have to set the CFBundleIconFile key to name of your icon. Hope it helps!

Problem

I want to set the application's icon that should be seen on the Dock of a Mac. To do so, I added to the .pro file the following line: ``` ICON = $$_PRO_FILE_PWD_/Icons/Icon144x144.icns ``` (I also tried `ICON = Icons/Icon144x144.icns`) If I understood Qt's documentation right, that should be enough but since my icon still can not be seen, I also added the following line to the mainwindow.cpp ``` setWindowIcon(QIcon("Icons/Icon144x144.icns")); ``` (I also tried with `QIcon("Icon144x144.icns")` and `QIcon("/Users/MYNAME/PROJECT/Icons/Icon144x144.icns")`). I know that there are two similar questions about this issue: QT/C++ on MAC - Application Icon doesn't set and Setting icon on a Mac with Qt but since I'm still not able to see the right icon, I'm thinking if there is something different in the way that Qt5 allows setting the app icon from previous versions. Any clue? EDIT: I just saw that qmake is not adding the icon to the Resources folder inside the app...

Original source

Related problems