当前位置:网站首页>Property animation QPropertyAnimation
Property animation QPropertyAnimation
2022-08-10 09:37:00 【Lee Neo】
widget.h
#include "widget.h"#include "ui_widget.h"#include #include Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){ui->setupUi(this);propertyAnimation = new QPropertyAnimation(ui->geometryWidget,"geometry");//Set the animation start value, key value, and end value;propertyAnimation->setStartValue(QRect(0,0,100,100));propertyAnimation->setKeyValueAt(0.5,QRect(0,400,200,200));propertyAnimation->setEndValue(QRect(600,400,200,200));//Set the animation often;propertyAnimation->setDuration(2000);//Set the animation cycle;propertyAnimation->setLoopCount(1);//Set animation easing curve; animation motion speed curve;propertyAnimation->setEasingCurve(QEasingCurve::InOutCubic);//set color animation;QGraphicsColorizeEffect *graphicsColorizeEffect = new QGraphicsColorizeEffect(this);ui->colorWidget->setGraphicsEffect(graphicsColorizeEffect);propertyAnimation1 = new QPropertyAnimation(graphicsColorizeEffect,"color");propertyAnimation1->setStartValue(QColor(Qt::black));propertyAnimation1->setEndValue(QColor(Qt::red));propertyAnimation1->setDuration(4000);// opacity animationQGraphicsOpacityEffect *graphicsOpacityEffect = new QGraphicsOpacityEffect(this);ui->colorWidget->setGraphicsEffect(graphicsOpacityEffect);propertyAnimation2 = new QPropertyAnimation(graphicsOpacityEffect,"opacity");propertyAnimation2->setStartValue(0.0);propertyAnimation2->setEndValue(1.0);propertyAnimation2->setDuration(2000);}Widget::~Widget(){delete ui;}void Widget::on_pushButton_clicked(){propertyAnimation->start();propertyAnimation2->start();}void Widget::on_pushButton_2_clicked(){propertyAnimation1->start();}
边栏推荐
- keepalived:主备配置
- 对称加密与非对称加密的区别
- 中国驻越南使馆提醒在越北部、中部地区中国公民做好台风“木兰”安全防范
- "Guangzhou highway engineering measures for the supervision and administration of production safety, and revised from six aspects
- MUDA:对齐特定域的分布和分类器以实现来自多源域的跨域分类
- JWT:拥有我,即拥有权力
- 微信小程序--》小程序生命周期和WXS使用
- Flink运行时架构 完整使用 (第四章)
- 00后女孩月薪3200,3年买两套房,这个程序员变现新风口千万要把握住
- 关于镜像源的一些记录
猜你喜欢
Defending risks with technology and escorting cloud native | Tongchuang Yongyi X Boyun held a joint product launch conference
【系统设计】S3 对象存储
傅立叶级数与傅里叶变换
CTFSHOW七夕杯web
J9 Digital Theory: What kind of sparks will Web3.0+ Internet e-commerce cause?
Shell functions and arrays
"Microservice Architecture" Arrangement and Choreography - Different Models for Making Systems Work Together
2022-08-09 第六小组 瞒春 学习笔记
「业务架构」TAGAF建模:业务服务/信息图
Flink部署 完整使用 (第三章)
随机推荐
How to break the DeepFake face-changing scam?turn him over
12 【其它组合式API】
FPGA中BEL Site Tile FSR SLR分别指什么?
英伟达游戏显卡营收暴跌/ 谷歌数据中心爆炸致3人受伤/ iPhone电量百分比回归…今日更多新鲜事在此...
makefile 杂项
Flink快速上手 完整使用 (第二章)
Static关键字及应用,继承的概念
Shell functions and arrays
shell遍历文件夹并输出
MUDA:对齐特定域的分布和分类器以实现来自多源域的跨域分类
幂次方(暑假每日一题 20)
【Software Exam System Architect】System Reliability Analysis and Design ① System Reliability Analysis
用高质量图像标注数据加速AI商业化落地
单例模式基类
支付 x 聚合 x 分账 - 回流平台“二清”风险规避之路
原型和原型链
初识Flink 完整使用 (第一章)
Hugo NexT主题升级记录
shell iterates over folders and outputs
傅立叶级数与傅里叶变换