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. Taskbar icon different from the icon of the window
QtWS25 Last Chance

Taskbar icon different from the icon of the window

Scheduled Pinned Locked Moved General and Desktop
17 Posts 2 Posters 12.8k Views
  • 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.
  • R Offline
    R Offline
    ReDKiiL
    wrote on last edited by
    #1

    Hey guys.

    I would like to know is it possible to create 2 different icons. one for the window and another to the taskbar

    1 Reply Last reply
    1
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to devnet.

      Which OS do you mean? Taskbar icon usually represents the icon of the main window (as in the first top most window of the process). You can set different icons for dialogs or tool windows with QWidget::setWindowIcon.

      At least on Windows you can also use a different icon for shortcuts and pinned apps, but that is set up either manually from outside the app or using WinAPI.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ReDKiiL
        wrote on last edited by
        #3

        [quote author="Chris Kawa" date="1409238075"]Hi, welcome to devnet.

        Which OS do you mean? Taskbar icon usually represents the icon of the main window (as in the first top most window of the process). You can set different icons for dialogs or tool windows with QWidget::setWindowIcon.

        At least on Windows you can also use a different icon for shortcuts and pinned apps, but that is set up either manually from outside the app or using WinAPI.[/quote]

        I'm using Windows 8.1, I wanted to just differentiate the icon title window icon in taskbar. There's no way to use Qt tools for this? I'm using Qt Creator 5.3

        1 Reply Last reply
        0
        • Chris KawaC Online
          Chris KawaC Online
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          As I said - the taskbar icon is taken from the first top most window in your app. There is no Qt API to set different icons because the OS doesn't provide it (except for the pinned apps and shortcuts).
          Honestly - why would you want to do that anyway? Have you seen any app doing that? Wouldn't that be confusing to the user?

          1 Reply Last reply
          0
          • R Offline
            R Offline
            ReDKiiL
            wrote on last edited by
            #5

            [quote author="Chris Kawa" date="1409254583"]As I said - the taskbar icon is taken from the first top most window in your app. There is no Qt API to set different icons because the OS doesn't provide it (except for the pinned apps and shortcuts).
            Honestly - why would you want to do that anyway? Have you seen any app doing that? Wouldn't that be confusing to the user?[/quote]

            I have the pleasure to make different icons.
            When I used Java was just define the sizes of icons in an array.
            I don't think it will be possible then, thanks for the help.

            1 Reply Last reply
            0
            • Chris KawaC Online
              Chris KawaC Online
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Well it's a bit of a trickery but if you create an .ico file with different sizes then you might get what you want. The window will use the small one (16px or 24px, I don't remember) while the task bar would use larger ones. To make it an application icon you put it in a resource file "as usually":http://qt-project.org/doc/qt-5/appicon.html.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                ReDKiiL
                wrote on last edited by
                #7

                I don't think it will be possible to do this.
                Could you tell me if you like at least remove the icon of the window?

                1 Reply Last reply
                0
                • Chris KawaC Online
                  Chris KawaC Online
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  [quote author="ReDKiiL" date="1409265345"]I don't think it will be possible to do this.[/quote]
                  I actually tried this and it works.
                  I created an icon with different images for various sizes (I know, I'm not da Vinci):!http://i296.photobucket.com/albums/mm188/crossblades666/icon.jpg(Icon)!

                  And then set that as an app icon. As I said the app window uses the small one (16px) while tha task bar takes a larger one (32px):!http://i296.photobucket.com/albums/mm188/crossblades666/app.jpg(Application icon)!

                  [quote author="ReDKiiL" date="1409265345"]Could you tell me if you like at least remove the icon of the window?[/quote]In Windows whether it has an icon or not depends on the window type and used windows flags. You can try to play around with window flags, eg.
                  @ setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint); @ but you might loose some other features in the process. Check other flags and see what you can come up with. For example tool windows(Qt::Tool flag) don't have an icon by default (but they can't be top level windows).
                  Another option is using the same trick as before: creating a fully transparent image for the 16px version. Of course this would also be invisible in the Explorer when someone switches to list view or other small icon mode.

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    ReDKiiL
                    wrote on last edited by
                    #9

                    [quote author="Chris Kawa" date="1409295819"]!http://i296.photobucket.com/albums/mm188/crossblades666/app.jpg(Application icon)!
                    [/quote]

                    Good! How did you do?
                    What program you use to create the icons?

                    1 Reply Last reply
                    0
                    • Chris KawaC Online
                      Chris KawaC Online
                      Chris Kawa
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      I did it "like I already described":http://qt-project.org/doc/qt-5/appicon.html
                      I used built-in Visual Studio editor but it's not very sophisticated. Basically any graphics program that supports .ico format will do. Some that I know or used in the past are IcoFX (free up to 1.6.4), Gimp, Paint.NET (with ico plugin), Inkscape(vector graphics) or even Photoshop (with a plugin).

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        ReDKiiL
                        wrote on last edited by
                        #11

                        I have to add the files into .ico extension? or. bmp?
                        I have to use the .rc file or add directly into the pro file?

                        1 Reply Last reply
                        0
                        • Chris KawaC Online
                          Chris KawaC Online
                          Chris Kawa
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          That wiki page says it all but let me recap.
                          If you don't already use a .rc file (which you most probably don't) then all you need to do is add in the .pro file
                          @
                          RC_ICONS = whatever.ico
                          @

                          .bmp format does not support multiple images in one file. .ico does. Use .ico.

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            ReDKiiL
                            wrote on last edited by
                            #13

                            How do I add more icons in just one line? in the pro file?

                            I'm trying to searching, there are times when I'm trying to make this work.
                            You could make your source code so I can see?

                            1 Reply Last reply
                            0
                            • Chris KawaC Online
                              Chris KawaC Online
                              Chris Kawa
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              You don't add multiple files. It's a single file.
                              .ico format supports multiple resolutions and bit depths inside a single file.
                              It has nothing to do with code(or Qt) and there's nothing more to show than the above line in the .pro file.

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                ReDKiiL
                                wrote on last edited by
                                #15

                                How can I create an icon with multiple picture inside?
                                I tried using Ico FX and GIMP. and I couldn't.

                                1 Reply Last reply
                                0
                                • Chris KawaC Online
                                  Chris KawaC Online
                                  Chris Kawa
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  Come on... do some work.
                                  http://youtu.be/4sAxiGek6VY
                                  http://youtu.be/bc_oWkBR7ow

                                  1 Reply Last reply
                                  0
                                  • R Offline
                                    R Offline
                                    ReDKiiL
                                    wrote on last edited by
                                    #17

                                    Finally, I get it! Thank you for your patience.

                                    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