Qt 窗体淡入淡出
在要结束的界面的方法中添加
//界面动画,改变透明度的方式消失1 - 0渐变 QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); animation->setDuration(1000); animation->setStartValue(1); animation->setEndValue(0); animation->start(); connect(animation, SIGNAL(finished()), this, SLOT(close()));
在开始界面构造函数中添加
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); animation->setDuration(1000); animation->setStartValue(0); animation->setEndValue(1); animation->start();
浙公网安备 33010602011771号