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. How to change taskbar icon during runtime on windows
QtWS25 Last Chance

How to change taskbar icon during runtime on windows

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 8.4k 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.
  • T Offline
    T Offline
    thomasitest
    wrote on last edited by
    #1

    Hi all,

    I've created a Qt application to talk with a remote device and I want to change the taskbar icon to show if the device is connected or not.

    I've tried it thanks to QWidget::setWindowIcon() on my mainwindow and later with QApplication::setWindowIcon().

    Both works fine when I run my app from Qtcreator.

    But, after deploying it, when I run my application "normally" (say windows start menu), the icon shown in the taskbar is the .exe file's icon (set thanks to "Setting the Application Icon":http://doc.qt.nokia.com/4.7-snapshot/appicon.html) and not the mainwindow icon...

    This result is the same on XP, Vista and Seven ...

    What am i missing ?

    Thanks in advance,
    tom.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fluca1978
      wrote on last edited by
      #2

      This could help to set the exe icon:http://doc.qt.nokia.com/4.7-snapshot/appicon.html

      1 Reply Last reply
      0
      • B Offline
        B Offline
        broadpeak
        wrote on last edited by
        #3

        I think, you won't see the QMainWindow's icon on the taskbar, because that icon is a Windows Resource Icon.
        In widget, you use Qt resource icon.
        Completely different.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thomasitest
          wrote on last edited by
          #4

          thank you for your prompt answers !

          @fluca1978 :
          I don't have any problem with the exe icon. It's correctly set thanks to the way explained in your link. My problem is that it's this icon which is shown in the task bar instead of those I wan't to set during runtime.

          @broadpeak :
          I'm affraid I don't understand what you mean (I'm a newbie ...) :
          I can set all widget icons I want inside my application but not the taskbar one because it is inevitably managed by the OS ?
          I won't be able to change it programmatically ?

          1 Reply Last reply
          0
          • B Offline
            B Offline
            broadpeak
            wrote on last edited by
            #5

            As I know, there are two kind of icons:
            Windows Resource Icon for applications (all other, yet Visual C++ uses too)
            and
            Qt Resource Icon for inside(!) in a Qt applications,
            for example widgets, dialogs and so one.
            The two are different!
            For example:
            the application icon is platform dependent!
            The other is platform INdependent.

            1 Reply Last reply
            0
            • F Offline
              F Offline
              fluca1978
              wrote on last edited by
              #6

              If I get it right the taskbar is showing the exe icon while you want another icon. As Broadpeak explained, the icon in the taskbar is platform dependent and depends on how the application "taskbar" on windows manages icons. I don't think there is a common and simple solution for this.

              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