[PySide] animated fade
Frank Rueter | OHUfx
frank at ohufx.com
Thu May 10 14:15:21 CEST 2012
I'm just trying to re-jig this example code to create an animated
Currently the above creates two classes, one "FaderWidget" class and one
"StackedWidget" class. The two work together to cross dissolve between
whatever widgets are passed into the FaderWidget's constructor.
I am trying to re-write this to not have to pass the child widgets into
the FaderWidget's constructor, but to use methods like "addWidget" to
allow me to pass the children to an instance of the FaderWidget.
In other words, I'm trying to subclass QStackedWidget and give it the
cross dissolve animation when setCurrentIndex is called on it, therefore
simplifying the way the widget works and not having to deal with two
Here is my attempt so far, but the problem is that the paintEvent is
called to soon, i.e. before the child widgets are available to draw a
pixmap of them.
Does anybody have an idea or comments on how to do this best? Maybe I
should aim for a layout that does this instead (subclassing QStackedLayout)?
Any help would be greatly appreciated.
On 4/16/12 11:54 PM, Frank Rueter | OHUfx wrote:
> Hi guys,
> I'm currently looking at an example that cross fades two widgets when
> the respective button is pushed.
> I have made a slight change to the sample code so that there is a button
> on each page that is meant to start the cross fade animation back to the
> other page (and therefore fade out itself). Looking at the terminal
> output, I can see the animation running and printing the incremental
> value changes, but the pages don't visibly animate when using the new
> When I use the old buttons at the bottom of the widget (the ones that
> aren't part of the animated widgets), it all works as expected. Both
> sets of buttons are hooked up to the same slot.
> What am I doing wrong?
> PySide mailing list
> PySide at qt-project.org
More information about the PySide