在开始界面构造函数中添加
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()));