src/gui/widgets/qwidgetanimator.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    86 
    86 
    87     // might make the wigdet go away by sending it to negative space
    87     // might make the wigdet go away by sending it to negative space
    88     const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
    88     const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
    89         QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());
    89         QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());
    90 
    90 
    91     if (r == final_geometry)
       
    92         return; //the widget is already where it should be
       
    93 #ifndef QT_NO_ANIMATION
    91 #ifndef QT_NO_ANIMATION
    94     AnimationMap::const_iterator it = m_animation_map.constFind(widget);
    92     AnimationMap::const_iterator it = m_animation_map.constFind(widget);
    95     if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry)
    93     if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry)
    96         return;
    94         return;
    97 
    95 
   103     connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
   101     connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
   104     anim->start(QPropertyAnimation::DeleteWhenStopped);
   102     anim->start(QPropertyAnimation::DeleteWhenStopped);
   105 #else
   103 #else
   106     //we do it in one shot
   104     //we do it in one shot
   107     widget->setGeometry(final_geometry);
   105     widget->setGeometry(final_geometry);
       
   106 #ifndef QT_NO_MAINWINDOW
   108     m_mainWindowLayout->animationFinished(widget);
   107     m_mainWindowLayout->animationFinished(widget);
       
   108 #endif //QT_NO_MAINWINDOW
   109 #endif //QT_NO_ANIMATION
   109 #endif //QT_NO_ANIMATION
   110 }
   110 }
   111 
   111 
   112 bool QWidgetAnimator::animating() const
   112 bool QWidgetAnimator::animating() const
   113 {
   113 {
   114     return !m_animation_map.isEmpty();
   114     return !m_animation_map.isEmpty();
   115 }
   115 }
   116 
   116 
   117 bool QWidgetAnimator::animating(QWidget *widget) const
       
   118 {
       
   119     return m_animation_map.contains(widget);
       
   120 }
       
   121 
       
   122 QT_END_NAMESPACE
   117 QT_END_NAMESPACE