赞
踩
- void MainWindow::addAnimationWidget(QSequentialAnimationGroup *Animation,QPushButton *widget)
- {
- int Durtime = 200;
- int startX = 600;
- if(!widget->isHidden())
- {
- QPropertyAnimation *pScaleAnimation = new QPropertyAnimation(widget, "pos");
- pScaleAnimation->setDuration(Durtime);
- pScaleAnimation->setStartValue(QPoint(200, widget->y()));
- pScaleAnimation->setEndValue(QPoint(widget->x(),widget->y()));
- pScaleAnimation->setEasingCurve(QEasingCurve::Linear);
- Animation->addAnimation(pScaleAnimation);
- widget->move(startX,widget->y());
- }
- }
- void MainWindow::on_currentChanged(int indexs)
- {
- if(Animation->state()==QSequentialAnimationGroup::Running){
- Animation->pause();
- Animation->resume();
- return;
- }
- Animation->clear();
- if(indexs ==0)
- {
- this->addAnimationWidget(Animation,ui->btn_1);
- this->addAnimationWidget(Animation,ui->btn_2);
- this->addAnimationWidget(Animation,ui->btn_3);
- this->addAnimationWidget(Animation,ui->btn_4);
- }
- else
- {
- this->addAnimationWidget(Animation,ui->btn_5);
- this->addAnimationWidget(Animation,ui->btn_6);
- this->addAnimationWidget(Animation,ui->btn_7);
- this->addAnimationWidget(Animation,ui->btn_8);
- }
- Animation->start();
- }
下载:源码
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。