1、主窗体渐变
QPropertyAnimation *animation =
new QPropertyAnimation(this,"windowOpacity");
animation->setDuration(500);
animation->setStartValue(1);
animation->setEndValue(0);
animation->setEasingCurve(QEasingCurve::Linear);
animation->start();
connect(animation, SIGNAL(finished()), this, SLOT(showlogout()));
2、子控件渐变
QGraphicsOpacityEffect *m_pGraphicsOpacityEffect =
new QGraphicsOpacityEffect(ui->groupBox_login);
m_pGraphicsOpacityEffect->setOpacity(1.0);
ui->groupBox_login->setGraphicsEffect(m_pGraphicsOpacityEffect);
QPropertyAnimation *animation =
new QPropertyAnimation(m_pGraphicsOpacityEffect,"opacity",ui->groupBox_login);
animation->setDuration(500);
animation->setStartValue(1);
animation->setEndValue(0);
animation->setEasingCurve(QEasingCurve::Linear);
animation->start();
connect(animation, SIGNAL(finished()), this, SLOT(showlogout()));