42 bool animate = rule == AnimationRule::Run;
43 QRect r = widget->geometry();
44 if (r.right() < 0 || r.bottom() < 0)
47 animate = animate && !r.isNull() && !_final_geometry.isNull();
50 const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
51 QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());
53#if QT_CONFIG(animation)
55 if (
const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animation_Duration,
nullptr, widget)) {
56 AnimationMap::const_iterator it = m_animation_map.constFind(widget);
57 if (it != m_animation_map.constEnd() && *it && (*it)->endValue().toRect() == final_geometry)
60 QPropertyAnimation *anim =
new QPropertyAnimation(widget,
"geometry", widget);
61 anim->setDuration(animate ? animationDuration : 0);
62 anim->setEasingCurve(QEasingCurve::InOutQuad);
63 anim->setEndValue(final_geometry);
64 m_animation_map[widget] = anim;
65 connect(anim, &QPropertyAnimation::destroyed,
this, [
this, widget]() { abort(widget); });
66 anim->start(QPropertyAnimation::DeleteWhenStopped);
71 widget->setGeometry(final_geometry);
72#if QT_CONFIG(mainwindow)
73 m_mainWindowLayout->animationFinished(widget);