Smooth animation on QStackedWidget
Posted
by
saravanan
on Stack Overflow
See other posts from Stack Overflow
or by saravanan
Published on 2011-02-07T07:20:42Z
Indexed on
2011/02/07
7:26 UTC
Read the original article
Hit count: 2252
Hi.,
i have five Qwidgets (Each QWidget having different controls). i put all the QWidget into one Parent QStackedWidget. for change the display of Qwidget i am using setCurrentIndex(int) function.
There is no problem in displaying. but i need to put animation while changing the page.
i tried nothing is working. so i removed the QStackedWidget and i put QWidget directly and i tried with QPropertyAnimation.
This QPropertyAnimation is working but it's not the smooth animation. Here my code for QPropertyAnimation.
QRect pGeo(8,152,width()-16,height()-160);
profilePage->show(); //first QWidget
QPropertyAnimation *anim1= new QPropertyAnimation(profilePage, "geometry");
anim1->setStartValue(QRect(200,pGeo.y(),pGeo.width(),pGeo.height()));
anim1->setEndValue(pGeo);
anim1->setEasingCurve(QEasingCurve::InOutSine);
anim1->setDuration(500);
anim1->start();
how to do the smooth animation using the QWidget or the QStackedWidget. Please give some suggestion to implement the smooth animation.
© Stack Overflow or respective owner