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