How to set application icon in a Qt-based project?

前端 未结 4 1410
无人及你
无人及你 2020-12-04 19:01

How do you set application icon for application made using Qt? Is there some easy way? It\'s a qmake-based project.

4条回答
  •  感情败类
    2020-12-04 19:30

    To extend Rob's answer, you can set an application icon for macOS by adding and modifying the following line onto your .pro file.

    macx: ICON = .icns
    

    Note that the ICON qmake variable is only meant to target macOS.

    For Windows, use

    • RC_ICONS = .ico if you're attaching a .ico file
    • or RC_FILE = .rc if you want to attach your icon through a .rc file. (Be sure to add IDI_ICON1 ICON DISCARDABLE "myappico.ico" into the rc file. Indentation not mine.)

    For further reading, see Setting the Application Icon.

提交回复
热议问题