开发者

Smooth animation on QStackedWidget

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 giv开发者_开发技巧e some suggestion to implement the smooth animation.


Try placing on QGraphicsWidget. it might work

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜