一杯清酒邀明月
天下本无事,庸人扰之而烦耳。

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

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

 

posted on 2024-05-29 14:09  一杯清酒邀明月  阅读(39)  评论(0编辑  收藏  举报