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. Fade label's pixmap from current to another
Qt 6.11 is out! See what's new in the release blog

Fade label's pixmap from current to another

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.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.
  • A Offline
    A Offline
    alexandros
    wrote on last edited by
    #1

    What is the best way to achieve this?

    I can fade out the label, change the image when fading is complete, and then fade in with the new image.

    What I wish to achieve is fade the old image immediately to the new one.

    What is the best way to achieve this?

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      You can subclass QWidget/QFrame and do the painting yourself. On every time you set an pixmap to your widget start a QPropertyAnimation which updates a value and triggers an update() on your widget. In the paint method then use the value to first draw the old pixmap and then the new pixmap with an calculated opacity.

      Second solution would be to use 2 QLabels (one with the old pixmap and one with the new pixmap) and again use a QPropertyAnimation to animate a QOpacityGraphicsEffect's (set on the labels) "opacity" property.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexandros
        wrote on last edited by
        #3

        Yes, I have already implemented it with the second solution that you mentioned on your post, but I hoped for something better.

        Thanks a lot :)

        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