From 91e0556fedf41eef49168396028f1d236d958ffc Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 24 Aug 2010 18:21:19 +0000 Subject: [PATCH] calculte intermediate values that actually make sense svn path=/trunk/KDE/kdelibs/; revision=1167476 --- animations/geometry.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/animations/geometry.cpp b/animations/geometry.cpp index f5b8b0d0d..d398ac039 100644 --- a/animations/geometry.cpp +++ b/animations/geometry.cpp @@ -80,12 +80,16 @@ void GeometryAnimation::updateEffectiveTime(int currentTime) if (w) { const qreal delta = currentTime / qreal(duration()); - QRectF newGeo = m_startGeometry; - newGeo.adjust((-m_startGeometry.x() + m_targetGeometry.x()) * delta, - (-m_startGeometry.y() + m_targetGeometry.y()) * delta, - (-m_startGeometry.width() + m_targetGeometry.width()) * delta, - (-m_startGeometry.height() + m_targetGeometry.height()) * delta); + QRectF newGeo; + newGeo.moveTopLeft(QPointF(m_startGeometry.left()*(1-delta) + m_targetGeometry.left()*(delta), + m_startGeometry.top()*(1-delta) + m_targetGeometry.top()*(delta))); + if (m_startGeometry.size() != m_targetGeometry.size()) { + newGeo.setSize(QSizeF(m_startGeometry.width()*(1-delta) + m_targetGeometry.width()*(delta), + m_startGeometry.width()*(1-delta) + m_targetGeometry.width()*(delta))); + } else { + newGeo.setSize(m_targetGeometry.size()); + } w->setGeometry(newGeo); } }