Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83696

Windows: Documentation for Application icon does not include Cmake directions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.15.1, 6.0.0 RC
    • 5.14.2
    • Documentation
    • Documentation
    • Windows
    • 33b7bf61824b80cf71042c31c505b73e82e11b37 (qt/qtdoc/dev) d089c60dfd513e27b0197f93c66fdaca6ef1e55e (qt/qtdoc/5.15) d48537ed2a585de7f1aba7c17616be7c3d0c503d (qt/qtdoc/dev)
    • Da Vinci sprint 11

      The documentation page for Setting the Application Icon( https://doc.qt.io/qt-5/appicon.html) does not include directions for getting application icons working with Qt on Windows with CMAKE. The current directions are for Qmake only. Adding these directions to the documentation would simplify the process for users acclimating to CMAKE.

      I found directions via the forums at this link, by the user name AmberShark: https://forum.qt.io/topic/81519/how-to-set-the-application-icon-on-windows-using-cmake/4

       

      The summary is:

      1. Create a resource file in the app folder. 
        • this might be something like project.rc
        • Open the file, and add the line: 
          • IDI_ICON1 ICON DISCARDABLE "appicon.ico"
        • In the above, the "appicon.ico" should correspond to an icon file in the same folder.
      2. Add the resource file in the cmake using the following line: 
        • add_executable(${PROJECT_NAME} ${SRCS} project.rc)

      In the above case, on item 2, I chose to add the resource file in the subdir where my main.cpp resides. My specific example looked like: 

      add_executable(${PROJECT_NAME}
        main.cpp
        ${SOURCES}
        qml.qrc 
        synapse.rc
      )

        For Gerrit Dashboard: QTBUG-83696
        # Subject Branch Project Status CR V

            veshivas Venugopal Shivashankar
            desodhi Devinder Sodhi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes