Important: Please read the Qt Code of Conduct -

Application icon for linux

  • Using setWindowIcon works for windows and mac, but not for linux. In ubuntu I only get a question mark icon in the left panel. I am using Ubuntu 12.04. I think Unity is the default gui. I have seen other executables which generate a nice icon in the left panel but have default icon in file explorer.

    setWindowIcon (all os ? )

    pro file:
    rc file (win)
    icns (mac)
    in linux it's not that easy (the icon, displayed in file explorer is not part of the executable ?)

  • I think it is adequately covered in the documentation under "Setting the Application Icon": and referenced "standards." The only part lacking is suggested location for the desktop files:

    • Per-user location for the desktop file is typically ".local/share/applications"
    • System wide "/usr/share/applications/".

    Your assessment is correct. The desktop icon on Linux is not part of the executable. It isn't for OS X either, it's just that the mechanism is standard so installing the separate file into the application bundle is easily automated. On Linux your installer (or application on first start) needs to take care of this based on the environment presented to it.

    On all platforms the desktop icon has no direct relationship to the application window icon. QApplication::setWindowIcon() works on all three desktop platforms.

Log in to reply