View Full Version : QLabel Text fade in/out
lamp
15th November 2010, 10:23
Hi
How to add fade in/out effect to QLabel Text ?
tbscope
15th November 2010, 10:40
http://doc.qt.nokia.com/4.7/qpropertyanimation.html
lamp
30th November 2010, 08:37
QLabel not propertyName Color or Opcity ?
tbscope
30th November 2010, 08:41
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.
lamp
30th November 2010, 08:48
ok!
But need a property to use with QPropertyAnimation to create fade in/out animat
tbscope
30th November 2010, 08:56
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.
praki
6th October 2016, 09:12
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);
}
Hope this will help
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.