setDuration(500); animation->setStartValue(1); animatio..._qpropertyanimation 颜色渐变">
当前位置:   article > 正文

Qt 设置窗体或控件渐变消失_qpropertyanimation 颜色渐变

qpropertyanimation 颜色渐变

1、主窗体渐变

  1. QPropertyAnimation *animation =
  2. new QPropertyAnimation(this,"windowOpacity");
  3. animation->setDuration(500);
  4. animation->setStartValue(1);
  5. animation->setEndValue(0);
  6. animation->setEasingCurve(QEasingCurve::Linear);
  7. animation->start();
  8. connect(animation, SIGNAL(finished()), this, SLOT(showlogout()));

2、子控件渐变

  1. QGraphicsOpacityEffect *m_pGraphicsOpacityEffect =
  2. new QGraphicsOpacityEffect(ui->groupBox_login);
  3. m_pGraphicsOpacityEffect->setOpacity(1.0);
  4. ui->groupBox_login->setGraphicsEffect(m_pGraphicsOpacityEffect);
  5. QPropertyAnimation *animation =
  6. new QPropertyAnimation(m_pGraphicsOpacityEffect,"opacity",ui->groupBox_login);
  7. animation->setDuration(500);
  8. animation->setStartValue(1);
  9. animation->setEndValue(0);
  10. animation->setEasingCurve(QEasingCurve::Linear);
  11. animation->start();
  12. connect(animation, SIGNAL(finished()), this, SLOT(showlogout()));

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/299560
推荐阅读
  

闽ICP备14008679号