How to set executable (application) icon in Linux based Qt

梦想与她 提交于 2019-12-05 05:30:29

问题


I

I want to change this default icon to my desired icon. How to do this ? I have searched and found solution for Windows How to set application icon in a Qt-based project? but not for Linux.

I have tried to do this using .desktop file by setting Icon = myPath/icon.icon or icon.PNG But it does not work. Any idea of how to do this ?


回答1:


This question isn't really Qt related.

In Linux, icons are set in the .desktop file in /usr/share/applications/ and not on the executable itself. To have an icon for your app, it must be installed on your system. Place the executable in /usr/bin, your icon of choice in /usr/share/icons/hicolor/ and put a .desktop file that corresponds to your application in /usr/share/applications:

[Desktop Entry]
Type=Application
Version=1.0
Name=(insert name of app)
GenericName=("Web Browser", "Media Player", etc. This isn't technically needed but makes your app look native on KDE)
Exec=(insert executable name)
Icon=(insert icon name)


来源:https://stackoverflow.com/questions/41690822/how-to-set-executable-application-icon-in-linux-based-qt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!