diff --git a/animations/fade.cpp b/animations/fade.cpp index 0d053031b..ecfc1d9f1 100644 --- a/animations/fade.cpp +++ b/animations/fade.cpp @@ -57,22 +57,9 @@ qreal FadeAnimation::targetOpacity() const return m_targetOpacity; } -void FadeAnimation::setWidgetToAnimate(QGraphicsWidget *widget) -{ - if (widget == widgetToAnimate()) { - return; - } - - Animation::setWidgetToAnimate(widget); - if (widget) { - widget->setOpacity(m_startOpacity); - } - -} - void FadeAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (!w) { return; } @@ -86,7 +73,7 @@ void FadeAnimation::updateState(QAbstractAnimation::State newState, QAbstractAni void FadeAnimation::updateCurrentTime(int currentTime) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (w) { qreal delta = currentTime / qreal(duration()); delta = (m_startOpacity - m_targetOpacity) * diff --git a/animations/fade_p.h b/animations/fade_p.h index a4c0633a2..92d52c2f1 100644 --- a/animations/fade_p.h +++ b/animations/fade_p.h @@ -82,15 +82,6 @@ public: */ void setTargetOpacity(qreal); - /** - * Set the widget on which the animation is to be performed. - * - * This animation reimplements it to make possible to apply the - * start opacity in the widget (see \ref setStartOpacity). - * @arg receiver The QGraphicsWidget to be animated. - */ - void setWidgetToAnimate(QGraphicsWidget *widget); - protected: void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); void updateCurrentTime(int currentTime); diff --git a/animations/geometry.cpp b/animations/geometry.cpp index 61b2bc6d6..0ba5a3b19 100644 --- a/animations/geometry.cpp +++ b/animations/geometry.cpp @@ -58,7 +58,7 @@ QRectF GeometryAnimation::targetGeometry() const void GeometryAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (!w) { return; } @@ -76,7 +76,7 @@ void GeometryAnimation::updateState(QAbstractAnimation::State newState, QAbstrac void GeometryAnimation::updateCurrentTime(int currentTime) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (w) { qreal delta = Animation::easingCurve().valueForProgress( currentTime / qreal(duration())); diff --git a/animations/grow.cpp b/animations/grow.cpp index d665ada79..f471a214a 100644 --- a/animations/grow.cpp +++ b/animations/grow.cpp @@ -42,7 +42,7 @@ qreal GrowAnimation::factor() const void GrowAnimation::updateCurrentTime(int currentTime) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (w && state() == QAbstractAnimation::Running) { qreal delta = Animation::easingCurve().valueForProgress( currentTime / qreal(duration())); @@ -56,7 +56,7 @@ void GrowAnimation::updateCurrentTime(int currentTime) void GrowAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) { - QGraphicsWidget *widget = widgetToAnimate(); + QGraphicsWidget *widget = targetWidget(); if (!widget) { return; } diff --git a/animations/rotation.cpp b/animations/rotation.cpp index f6f8e943e..797e6ae86 100644 --- a/animations/rotation.cpp +++ b/animations/rotation.cpp @@ -75,7 +75,7 @@ void RotationAnimation::setAngle(const qreal &angle) void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { - QGraphicsWidget *m_object = widgetToAnimate(); + QGraphicsWidget *m_object = targetWidget(); if (!m_object) { return; @@ -157,7 +157,7 @@ void RotationAnimation::updateState(QAbstractAnimation::State newState, QAbstrac void RotationAnimation::updateCurrentTime(int currentTime) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (w) { qreal delta = Animation::easingCurve().valueForProgress( currentTime / qreal(duration())); diff --git a/animations/rotationstacked.cpp b/animations/rotationstacked.cpp index 67e54b95b..7093494fa 100644 --- a/animations/rotationstacked.cpp +++ b/animations/rotationstacked.cpp @@ -70,8 +70,8 @@ void RotationStackedAnimation::setBackWidget(QGraphicsWidget *backWidget) { m_backWidget = backWidget; - if(widgetToAnimate()) { - sLayout->addWidget(widgetToAnimate()); + if(targetWidget()) { + sLayout->addWidget(targetWidget()); sLayout->addWidget(m_backWidget.data()); } } @@ -88,7 +88,7 @@ void RotationStackedAnimation::updateState( return; } - QPair widgets = qMakePair(widgetToAnimate(), backWidget()); + QPair widgets = qMakePair(targetWidget(), backWidget()); const qreal widgetFrontWidth = widgets.first->size().width(); const qreal widgetFrontHeight = widgets.first->size().height(); @@ -142,7 +142,7 @@ void RotationStackedAnimation::updateState( void RotationStackedAnimation::updateCurrentTime(int currentTime) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if(w) { qreal delta; if (currentTime <= duration()/2) { diff --git a/animations/slide.cpp b/animations/slide.cpp index 4458a1772..33fe5ff3e 100644 --- a/animations/slide.cpp +++ b/animations/slide.cpp @@ -60,7 +60,7 @@ qint8 SlideAnimation::movementDirection() const void SlideAnimation::updateCurrentTime(int currentTime) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (w && state() == QAbstractAnimation::Running) { qreal delta = Animation::easingCurve().valueForProgress( currentTime / qreal(duration())); @@ -71,10 +71,10 @@ void SlideAnimation::updateCurrentTime(int currentTime) void SlideAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running) { - if (!widgetToAnimate()) { + if (!targetWidget()) { return; } - m_startPos = widgetToAnimate()->pos(); + m_startPos = targetWidget()->pos(); qreal newX = m_startPos.x(); qreal newY = m_startPos.y(); diff --git a/animations/zoom.cpp b/animations/zoom.cpp index 7ef68d2cc..af658b4bf 100644 --- a/animations/zoom.cpp +++ b/animations/zoom.cpp @@ -47,7 +47,7 @@ qreal ZoomAnimation::zoom() const void ZoomAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (!w) { return; } @@ -62,7 +62,7 @@ void ZoomAnimation::updateState(QAbstractAnimation::State newState, QAbstractAni void ZoomAnimation::updateCurrentTime(int currentTime) { - QGraphicsWidget *w = widgetToAnimate(); + QGraphicsWidget *w = targetWidget(); if (w) { qreal delta = Animation::easingCurve().valueForProgress( currentTime / qreal(duration()));