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();

 

posted on 2016-12-06 14:51  Just_Boy  阅读(963)  评论(0)    收藏  举报