diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-01-12 12:55:32 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-01-17 19:45:00 +0000 |
commit | 66c2513f2abceb38fd5770bb915b35b1b15bb69a (patch) | |
tree | f0036f84d98009d5cb8e7d3262a7d844b13d619f /src/particles/qquickgravity.cpp | |
parent | 0412de08fd65c5fef9d010a68b40a256f521ef61 (diff) |
QQuickGravityAffector: Move implementations from header to cpp
These are not performance-critical, so it's cleaner to do this.
Change-Id: I6a876636d50e2bfe25f9e6e882d9a98dc032101e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/particles/qquickgravity.cpp')
-rw-r--r-- | src/particles/qquickgravity.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/particles/qquickgravity.cpp b/src/particles/qquickgravity.cpp index 90f305f336..835790ce7d 100644 --- a/src/particles/qquickgravity.cpp +++ b/src/particles/qquickgravity.cpp @@ -64,16 +64,54 @@ const qreal CONV = 0.017453292520444443; Pixels per second that objects will be accelerated by. */ +void QQuickGravityAffector::setMagnitude(qreal arg) +{ + if (m_magnitude != arg) { + m_magnitude = arg; + m_needRecalc = true; + emit magnitudeChanged(arg); + } +} + +qreal QQuickGravityAffector::magnitude() const +{ + return m_magnitude; +} + + /*! \qmlproperty real QtQuick.Particles::Gravity::acceleration Name changed to magnitude, will be removed soon. */ +void QQuickGravityAffector::setAcceleration(qreal arg) +{ + qWarning() << "Gravity::acceleration has been renamed Gravity::magnitude"; + if (m_magnitude != arg) { + m_magnitude = arg; + m_needRecalc = true; + emit magnitudeChanged(arg); + } +} + /*! \qmlproperty real QtQuick.Particles::Gravity::angle Angle of acceleration. */ +void QQuickGravityAffector::setAngle(qreal arg) +{ + if (m_angle != arg) { + m_angle = arg; + m_needRecalc = true; + emit angleChanged(arg); + } +} + +qreal QQuickGravityAffector::angle() const +{ + return m_angle; +} QQuickGravityAffector::QQuickGravityAffector(QQuickItem *parent) : QQuickParticleAffector(parent), m_magnitude(-10), m_angle(90), m_needRecalc(true) @@ -94,4 +132,7 @@ bool QQuickGravityAffector::affectParticle(QQuickParticleData *d, qreal dt) d->setInstantaneousVY(d->curVY(m_system) + m_dy*dt, m_system); return true; } + + + QT_END_NAMESPACE |