slide from one widget to another
2024-10-14 15:05:50
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget panel;
QVBoxLayout *l = new QVBoxLayout(&panel);
QFrame *viewport = new QFrame;
viewport->setFrameShape(QFrame::Box);
viewport->setFixedSize(,); l->addWidget(viewport);
QPushButton *b = new QPushButton("Swap");
l->addWidget(b);
QStateMachine machine;
QState *s1 = new QState;
QState *s2 = new QState; QWidget *w1 = new QCalendarWidget(viewport);
w1->setFixedSize(,);
QWidget *w2 = new QListView(viewport);
w2->setFixedSize(,); QGraphicsBlurEffect *e1 = new QGraphicsBlurEffect(w1);
QGraphicsBlurEffect *e2 = new QGraphicsBlurEffect(w2);
w1->setGraphicsEffect(e1);
w2->setGraphicsEffect(e2); s1->assignProperty(w1, "pos", QPoint(,));
s1->assignProperty(w2, "pos", QPoint(,));
s1->assignProperty(e1, "blurRadius", );
s1->assignProperty(e2, "blurRadius", );
s2->assignProperty(w1, "pos", QPoint(-, ));
s2->assignProperty(w2, "pos", QPoint(,));
s2->assignProperty(e1, "blurRadius", );
s2->assignProperty(e2, "blurRadius", ); s1->addTransition(b, SIGNAL(clicked()), s2);
s2->addTransition(b, SIGNAL(clicked()), s1); machine.addState(s1);
machine.addState(s2); QPropertyAnimation *anim1 = new QPropertyAnimation(w1, "pos");
QPropertyAnimation *anim2 = new QPropertyAnimation(w2, "pos");
anim1->setEasingCurve(QEasingCurve::InOutCubic);
anim2->setEasingCurve(anim1->easingCurve());
anim1->setDuration();
anim2->setDuration(anim1->duration());
machine.addDefaultAnimation(anim1);
machine.addDefaultAnimation(anim2); anim1 = new QPropertyAnimation(e1, "blurRadius");
anim2 = new QPropertyAnimation(e2, "blurRadius");
anim1->setDuration();
anim2->setDuration(anim1->duration());
machine.addDefaultAnimation(anim1);
machine.addDefaultAnimation(anim2);
machine.setInitialState(s1);
machine.start();
panel.show();
return app.exec();
}
slide from one widget to another
最新文章
- Salesforce Apex 开发环境设置和Hello World示例
- JavaScript异步编程的主要解决方案—对不起,我和你不在同一个频率上
- python数字图像处理(9):直方图与均衡化
- 使用redis的五个注意事项
- 锋利的jQuery-7--$.extend()
- 为什么我不再用 .NET 框架(转)
- Shell脚本的安全性
- [学姿势]实验室搬砖+node学习
- android 43 SQLite数据库
- BZOJ 1537: [POI2005]Aut- The Bus(dp + BIT)
- 怎样用Java编写一段代码引发内存泄露
- HTC one/M7电信802d 毒蛇ViperOne2.1.0/高级毒蛇工具/完美root,精简/更多自定义,稳定,流畅ROM
- 【图文详解】Hadoop集群搭建(CentOs6.3)
- Linux-服务器创建swap交换分区
- jQuery ajax 传递JSON数组到Spring Controller
- shouldComponentUpdate 是做什么的,(react 性能优化是哪个周期函数?)
- R语言三元相图的做法
- 【框架】PageObject(一)
- picasso 在魅族手机无法加载缩略图的bug
- Java程序(非web)slf4j整合Log4j2
热门文章
- OpenXml2.0 - 找不到类型或命名空间名称“DocumentFormat”
- mysql window下tmpdir空间耗尽
- 武汉科技大学ACM :1004: 华科版C语言程序设计教程(第二版)课后习题3.7
- 解决Windows服务1053错误方法
- 解决.VS2012+EF5.0开发的网站在window server2003上无法部署的问题(转载)
- thinkphp3.23整合phpexcel
- C#实现打印与打印预览功能(转)
- java之多线程的理解
- empty()方法
- html标签引入外部html