Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTCreator Application Icon
Qt 6.11 is out! See what's new in the release blog

QTCreator Application Icon

Scheduled Pinned Locked Moved General and Desktop
7 Posts 6 Posters 13.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 2 Offline
    2 Offline
    2JSwed
    wrote on last edited by
    #1

    Hello,
    i try to set application icon but it doesn't work.

    What i did :

    -I have create ressource.rc file and add :

    @
    IDI_ICON1 ICON DISCARDABLE "gear.ico"
    @

    -I have push gear.ico in the .pro folder :
    "Img":http://www.hostingpics.net/viewer.php?id=813808bugQT.png

    -And my .pro file :
    "Img":http://www.hostingpics.net/viewer.php?id=970014bugQT2.png

    What is the problem ? My application icon don't change.
    Thanks advanced for the help.
    Bye.

    [EDIT: code formatting, Volker]

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      add line to end of your .pro file:
      @win32:RC_FILE = ressource.rc@

      --
      Vasiliy

      1 Reply Last reply
      0
      • 2 Offline
        2 Offline
        2JSwed
        wrote on last edited by
        #3

        Nothing has changed.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          For what it's worth, I have in my .rc file:

          @
          DI_ICON1 ICON DISCARDABLE "application.ico"
          @

          Note, that it's DI_ICON1, not IDI_ICON1 (the first I is superfluous).

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • A Offline
            A Offline
            asouthwick
            wrote on last edited by
            #5

            I'm creating a secondary window and showing it using showFullScreen, and it's ALT-TAB icon is the generic app icon. Using IDI_ICON1 instead of DI_* fixes that, and appears to work everywhere else as well. I'm actually using both, since I'm trying to maintain functionality across Windows platforms from XP to 8.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jake007
              wrote on last edited by
              #6

              You can set an app for Qt application in code. No .rc files needed, and all further windows will automatically inherit this icon.

              My solution:

              @// in main.cpp
              QApplication a(argc, argv);

              #ifndef APPLE
              a.setWindowIcon(QIcon(":icon.ico"));
              #endif
              @

              On OS X program crashes on a.setWindowIcon line ( that's why preprocessor directives). As I know, you need to use apple ico format, but i didn't test it in theory ( I worked on friends macbook back then ).


              Code is poetry

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Macro
                wrote on last edited by
                #7

                Yeah, I think Jake is Right... Try By using and write us whether it works or not.

                @a.setWindowIcon(QIcon("fileName.ico"));@

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved