Qt 窗体淡入淡出


在开始界面构造函数中添加

1 QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); 2 animation>setDuration(1000); 3 animation>setStartValue(0); 4 animation>setEndValue(1); 5 animation>start();

在要结束的界面的方法中添加

1 //界面动画,改变透明度的方式消失1 0渐变 2 QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); 3 animation>setDuration(1000); 4 animation>setStartValue(1); 5 animation>setEndValue(0); 6 animation>start(); 7 connect(animation, SIGNAL(finished()), this, SLOT(close()));



上一篇:Qt 解决报错registered using qRegisterMetaType()

下一篇:Qt 之 QProgressIndicator(等待提示框)


Qt
Copyright © 2002-2019 k262电脑网 www.k262.cn 皖ICP备2020016292号
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!QQ:251442993 热门搜索 网站地图