Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Throbber transparency with QToolbar
Qt 6.12 LTS is out! See what's new in the release blog

Throbber transparency with QToolbar

Scheduled Pinned Locked Moved Solved Qt for Python
5 Posts 3 Posters 1.2k 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.
  • S Offline
    S Offline
    stef.pellegrino
    wrote on last edited by stef.pellegrino
    #1

    Hi,
    I'm trying to add an animated gif on a QToolbar()
    Almost work, doing that:

        mov = QMovie("waiting.gif", parent=self)
        lbl = QLabel(self)
    
        mov.setScaledSize(QSize(32, 32))
        lbl.setMovie(mov)
        lbl.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
        lbl.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
        my_toolbar.addWidget(lbl)
        mov.start()
    

    But, doesn't work, the background remains black !!

    Perhaps something to do/change with the gif itself ?

    waiting.gif

    Any ideas ?
    Thanks for you help

    jsulmJ 1 Reply Last reply
    0
    • S stef.pellegrino

      Hi,
      I'm trying to add an animated gif on a QToolbar()
      Almost work, doing that:

          mov = QMovie("waiting.gif", parent=self)
          lbl = QLabel(self)
      
          mov.setScaledSize(QSize(32, 32))
          lbl.setMovie(mov)
          lbl.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground)
          lbl.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
          my_toolbar.addWidget(lbl)
          mov.start()
      

      But, doesn't work, the background remains black !!

      Perhaps something to do/change with the gif itself ?

      waiting.gif

      Any ideas ?
      Thanks for you help

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @stef-pellegrino said in Throbber transparency with QToolbar:

      mov = QMovie("waiting.gif", parent=self)

      You are using a relative path to the image: are you sure your app can find it at runtime?
      You should put it into a resource: https://doc.qt.io/qt-6/resources.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      0
      • jsulmJ jsulm

        @stef-pellegrino said in Throbber transparency with QToolbar:

        mov = QMovie("waiting.gif", parent=self)

        You are using a relative path to the image: are you sure your app can find it at runtime?
        You should put it into a resource: https://doc.qt.io/qt-6/resources.html

        S Offline
        S Offline
        stef.pellegrino
        wrote on last edited by
        #3

        @jsulm Yes the gis is well loaded.

        I think the issue comes from the background of the gif itself

        JonBJ 1 Reply Last reply
        0
        • S stef.pellegrino

          @jsulm Yes the gis is well loaded.

          I think the issue comes from the background of the gif itself

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @stef-pellegrino Well let's start with: does the GIF have a background?

          S 1 Reply Last reply
          1
          • JonBJ JonB

            @stef-pellegrino Well let's start with: does the GIF have a background?

            S Offline
            S Offline
            stef.pellegrino
            wrote on last edited by stef.pellegrino
            #5

            @JonB Hi,

            Ok, sorry for wasting your time, the gif "transparent region" was setting on black, I changed it to "white" and it works !
            Nevertheless Don't really know why !? (I need some tutorials about gif transparency I guess :))

            1 Reply Last reply
            1

            • Login

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