View Full Version : QPropertyAnimation dynamic end value is this possible?

11th March 2011, 02:53

I am trying to create a transition annimation between two custom widgets.

I want the current widget to annimate out of the screen and be replaced by the incomming widget.

what I don't understand is how I can create the end pos of my transition to be the current screen width, if I switch between landscape and portrait this value will change.

currently in my QPropertyAnimation I have the end value hard coded, what i want to be able to do is set this to be the current screen width.

AnimateOut->setEndValue(QPoint(360,0)); // really this end value should be the screen width

is it possible do this dynamically or is there another way to do this?

thanks in advance

Guus Davidson

11th March 2011, 12:09

Is your question how to query the current screen width and pass it to setEndValue once or do you want to cover the case that the user turns the screen while your animation is running?

If the former, have a look at QDesktopWidget. If the later you could restart your animation in QDesktopWidget's resize event.