kdeui: animate the height of KMessageWidget from KMessageWidget::animatedHide()

can animate the opacity too but size change animation suits better a
message widget that is not dialog, still it happens in 500ms and renders
much faster than the previous snapshot-based approach so..

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-07-07 07:55:35 +03:00
parent 8bf6e8bd73
commit c32db57584

View file

@ -317,7 +317,7 @@ void KMessageWidget::animatedShow()
d->animation = new QPropertyAnimation(this, "windowOpacity", this);
d->animation->setStartValue(0.0);
d->animation->setEndValue(1.0);
d->animation->setEasingCurve(QEasingCurve::InOutQuad);
d->animation->setEasingCurve(QEasingCurve::InQuad);
d->animation->setDuration(s_kmessageanimationduration);
d->animation->start();
QFrame::show();
@ -339,10 +339,11 @@ void KMessageWidget::animatedHide()
return;
}
d->animation = new QPropertyAnimation(this, "windowOpacity", this);
d->animation->setStartValue(1.0);
d->animation->setEndValue(0.0);
d->animation->setEasingCurve(QEasingCurve::InOutQuad);
setMaximumHeight(height());
d->animation = new QPropertyAnimation(this, "maximumHeight", this);
d->animation->setStartValue(height());
d->animation->setEndValue(0);
d->animation->setEasingCurve(QEasingCurve::OutQuad);
d->animation->setDuration(s_kmessageanimationduration);
d->animation->start();
QFrame::hide();