Icon in Qt

  • As described "here":http://developer.qt.nokia.com/doc/qt-4.8/appicon.html it is easy to set an icon for mac.
    I have done as described:

    bq. If you are using qmake to generate your makefiles, you only need to add a single line to your .pro project file. For example, if the name of your icon file is myapp.icns, and your project file is myapp.pro, add this line to myapp.pro:
    ICON = myapp.icns

    And I also added this line

    QMAKE_INFO_PLIST = Info.plist

    My program compiles as usual but I cannot see an Icon. I would like to have it as an Dock-icon and as well as an icon before the file-name.

    What have I done wrong?

  • So, you have the myapp.icns in your project?
    Does the contents of you individual Info.plist match the name of your icns file that is copied into the bundle later? Be aware that Info.plist refers to the filename in the bundle.

  • Thank you for your answer. This plist-stuff is a bit confusing.
    According to the docu only this line:

    ICON= icon.icns

    would be enough. But it's not working. I have the plist line because I have seen it in an example.With it it compiles, but there is no icon to be seen.

    The icon is in project-folder. It has the name of my project.

  • ICON= icon.icns just sets the icon that is shown in the Finder and in the Dock (if you don't set a different icon in the code). It must be in the special Mac icon format. You can create it with Icon Composer from other formats.

    For setting the application icon in window title bars etc, call setWindowIcon() in your code. That icon's format needs to be recognized by Qt, I usually use PNG here.

    The plist-line is not necessary to just set the icon, the two steps above are sufficient for that. Just make sure that your icns

Log in to reply