Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Showcase
  4. Interactive application icon
Forum Updated to NodeBB v4.3 + New Features

Interactive application icon

Scheduled Pinned Locked Moved Unsolved Showcase
6 Posts 2 Posters 43 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.
  • M Offline
    M Offline
    Mizmas
    wrote last edited by
    #1

    JonBJ 1 Reply Last reply
    0
    • M Mizmas

      JonBJ Online
      JonBJ Online
      JonB
      wrote last edited by
      #2

      @Mizmas At a guess, depends on your platform/window manager?

      M 1 Reply Last reply
      0
      • JonBJ JonB

        @Mizmas At a guess, depends on your platform/window manager?

        M Offline
        M Offline
        Mizmas
        wrote last edited by
        #3

        @JonB It's actually really simple, the application's icon is just an image, so you just need an image representation of a widget, and when that widget changes, you can just update the application's icon like this:

        pixmap = self.slider_frame.grab()
        self.setWindowIcon(QIcon(pixmap))
        

        grab() returns a pixmap, update the pixmap each time the slider moves, set the pixmap as the new icon.
        You can also do the same thing for the tray icon.
        You can also use a QMovie animation, for example

        pixmap = self.animation.currentPixmap()
        

        So if you combine everything, you can have an event driven interactive application icon / system tray icon

        JonBJ 1 Reply Last reply
        0
        • M Mizmas

          @JonB It's actually really simple, the application's icon is just an image, so you just need an image representation of a widget, and when that widget changes, you can just update the application's icon like this:

          pixmap = self.slider_frame.grab()
          self.setWindowIcon(QIcon(pixmap))
          

          grab() returns a pixmap, update the pixmap each time the slider moves, set the pixmap as the new icon.
          You can also do the same thing for the tray icon.
          You can also use a QMovie animation, for example

          pixmap = self.animation.currentPixmap()
          

          So if you combine everything, you can have an event driven interactive application icon / system tray icon

          JonBJ Online
          JonBJ Online
          JonB
          wrote last edited by
          #4

          @Mizmas And that would work in, say, GNOME? I thought that just uses a static file for its icon?

          M 1 Reply Last reply
          0
          • JonBJ JonB

            @Mizmas And that would work in, say, GNOME? I thought that just uses a static file for its icon?

            M Offline
            M Offline
            Mizmas
            wrote last edited by
            #5

            @JonB I don't use Linux so IDK

            JonBJ 1 Reply Last reply
            0
            • M Mizmas

              @JonB I don't use Linux so IDK

              JonBJ Online
              JonBJ Online
              JonB
              wrote last edited by JonB
              #6

              @Mizmas
              ...which is why I said it would probably depend on your platform/window manager which you didn't say...

              [TBH I had not noticed initially that this was Showcase, I thought you were asking if you could do this from Qt.] Your showcase is fine, just you might like to mention this if it's e.g. Windows-only as Qt is cross-platform.

              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