PDA

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



GuusDavidson
11th March 2011, 02:53
Hi

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->setStartValue(QPoint(0,0));
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

JohannesMunk
11th March 2011, 12:09
Hi!

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.

http://www.qtcentre.org/threads/30181-Application-Resizing-on-Display-resolution-change?p=141351#post141351

HIH

Joh