diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-08 23:42:37 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-04-08 23:42:37 +0200 |
commit | b9eca979f8557aa1d7f3cb1af01284720d23a425 (patch) | |
tree | 7bbc1cc7b17a6c65e43352dd55bfa77f5b2d5c39 /src/quick/util | |
parent | 1148d3acead3c13072876b873fb4ee9440921943 (diff) | |
parent | dab3fa107fa7b4a82928b71748b857ff85180f1e (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I48c493b537e65276107ed7ee029312e294947e8b
Diffstat (limited to 'src/quick/util')
-rw-r--r-- | src/quick/util/qquickanimation.cpp | 4 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob.cpp | 17 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob_p.h | 2 | ||||
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 1 |
4 files changed, 15 insertions, 9 deletions
diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index 51212661c9..adf8f600a0 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -1441,7 +1441,7 @@ QQuickVector3dAnimation::~QQuickVector3dAnimation() } /*! - \qmlproperty real QtQuick::Vector3dAnimation::from + \qmlproperty vector3d QtQuick::Vector3dAnimation::from This property holds the starting value for the animation. If the Vector3dAnimation is defined within a \l Transition or \l Behavior, @@ -1463,7 +1463,7 @@ void QQuickVector3dAnimation::setFrom(QVector3D f) } /*! - \qmlproperty real QtQuick::Vector3dAnimation::to + \qmlproperty vector3d QtQuick::Vector3dAnimation::to This property holds the end value for the animation. If the Vector3dAnimation is defined within a \l Transition or \l Behavior, diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index d7be237a39..8d5ecadab5 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -238,6 +238,10 @@ void QQuickAnimatorJob::debugAnimation(QDebug d) const << "target:" << m_target << "value:" << m_value; } +qreal QQuickAnimatorJob::progress(int time) const +{ + return m_easing.valueForProgress((m_duration == 0) ? qreal(1) : qreal(time) / qreal(m_duration)); +} qreal QQuickAnimatorJob::value() const { qreal v; @@ -388,7 +392,7 @@ void QQuickXAnimatorJob::updateCurrentTime(int time) return; Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_helper->dx = m_value; m_helper->wasChanged = true; } @@ -405,7 +409,7 @@ void QQuickYAnimatorJob::updateCurrentTime(int time) return; Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_helper->dy = m_value; m_helper->wasChanged = true; } @@ -475,7 +479,7 @@ void QQuickOpacityAnimatorJob::updateCurrentTime(int time) return; Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_opacityNode->setOpacity(m_value); } @@ -491,7 +495,7 @@ void QQuickScaleAnimatorJob::updateCurrentTime(int time) return; Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); m_helper->scale = m_value; m_helper->wasChanged = true; } @@ -511,7 +515,8 @@ void QQuickRotationAnimatorJob::updateCurrentTime(int time) return; Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - float t = m_easing.valueForProgress(time / (qreal) m_duration); + float t = progress(time); + switch (m_direction) { case QQuickRotationAnimator::Clockwise: m_value = _q_interpolateClockwiseRotation(m_from, m_to, t).toFloat(); @@ -594,7 +599,7 @@ void QQuickUniformAnimatorJob::updateCurrentTime(int time) if (!m_node || m_uniformIndex == -1 || m_uniformType == -1) return; - m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); + m_value = m_from + (m_to - m_from) * progress(time); QQuickShaderEffectMaterial *material = static_cast<QQuickShaderEffectMaterial *>(m_node->material()); diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 71c1e93746..2b910d3737 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -158,6 +158,8 @@ protected: QQuickAnimatorJob(); void debugAnimation(QDebug d) const Q_DECL_OVERRIDE; + qreal progress(int time) const; + QPointer<QQuickItem> m_target; QQuickAnimatorController *m_controller; diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 23b2887fac..2b6e8f68c3 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -530,7 +530,6 @@ void QQuickPixmapReader::asyncResponseFinished(QQuickImageResponse *response) QQuickTextureFactory *t = 0; QQuickPixmapReply::ReadError error = QQuickPixmapReply::NoError; QString errorString; - QSize readSize; if (!response->errorString().isEmpty()) { error = QQuickPixmapReply::Loading; errorString = response->errorString(); |