Hi
How to add fade in/out effect to QLabel Text ?
Hi
How to add fade in/out effect to QLabel Text ?
QLabel not propertyName Color or Opcity ?
It has a font property, but that would not work too well with rich text in a label.
And if you want another convenience property, you can easily add one.
ok!
But need a property to use with QPropertyAnimation to create fade in/out animat
Last edited by lamp; 30th November 2010 at 08:53.
I guess you can look here too:
http://doc.qt.nokia.com/qq/qq16-fader.html
As for the property, the font property will work, but not for richt text.
Qt Code:
void MainWindow::on_pushButton_clicked() { QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(); ui->label->setGraphicsEffect(effect); QPropertyAnimation *anim = new QPropertyAnimation(effect,"opacity"); anim->setDuration(1000); anim->setStartValue(1.0); anim->setEndValue(0.0); anim->setEasingCurve(QEasingCurve::OutQuad); connect(anim, &QPropertyAnimation::finished, [=]() { ui->label->setText("gone"); }); anim->start(QAbstractAnimation::DeleteWhenStopped); }To copy to clipboard, switch view to plain text mode
Hope this will help
Last edited by anda_skoa; 6th October 2016 at 16:36. Reason: missing [code] tags
Bookmarks