summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-04 19:57:44 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-04 19:57:44 (GMT)
commitfa8612b3ff33ecd4477776829990da137bd52065 (patch)
treecceb86770fc0da25ab4b9be5e4c433bbb0fb813f /src/imports
parente3ee3780777b07e6283a8b33cd4f7e1d56241d1c (diff)
parent65c063a531810f5a21c00a0afb81cdd68d0d6961 (diff)
downloadQt-fa8612b3ff33ecd4477776829990da137bd52065.zip
Qt-fa8612b3ff33ecd4477776829990da137bd52065.tar.gz
Qt-fa8612b3ff33ecd4477776829990da137bd52065.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Move QListModelInterface into util. Ensure ParticleMotionGravity always pulls in the right direction. Remove version ifdefs from Particles; only 4.7 is supported. Update docs for the runtime.orientation values Revert to Portrait/Landscape terminology for Orientation enum, with Add more Q_AUTOTEST_EXPORTs Improve input panel handling in declarative demos and examples Always integer align anchor center points Add header and footer to GridView
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/particles/qdeclarativeparticles.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp
index ecc6604..630c068 100644
--- a/src/imports/particles/qdeclarativeparticles.cpp
+++ b/src/imports/particles/qdeclarativeparticles.cpp
@@ -241,11 +241,13 @@ void QDeclarativeParticleMotionGravity::setAcceleration(qreal accel)
void QDeclarativeParticleMotionGravity::advance(QDeclarativeParticle &p, int interval)
{
- qreal xdiff = p.x - _xAttr;
- qreal ydiff = p.y - _yAttr;
+ qreal xdiff = _xAttr - p.x;
+ qreal ydiff = _yAttr - p.y;
+ qreal absXdiff = qAbs(xdiff);
+ qreal absYdiff = qAbs(ydiff);
- qreal xcomp = xdiff / (xdiff + ydiff);
- qreal ycomp = ydiff / (xdiff + ydiff);
+ qreal xcomp = xdiff / (absXdiff + absYdiff);
+ qreal ycomp = ydiff / (absXdiff + absYdiff);
p.x_velocity += xcomp * _accel * interval;
p.y_velocity += ycomp * _accel * interval;
@@ -1284,11 +1286,7 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics
const int myX = x() + parentItem()->x();
const int myY = y() + parentItem()->y();
-#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
QVarLengthArray<QPainter::PixmapFragment, 256> pixmapData;
-#else
- QVarLengthArray<QDrawPixmaps::Data, 256> pixmapData;
-#endif
pixmapData.resize(d->particles.count());
const QRectF sourceRect = d->image.rect();
@@ -1296,32 +1294,20 @@ void QDeclarativeParticlesPainter::paint(QPainter *p, const QStyleOptionGraphics
qreal halfPHeight = sourceRect.height()/2.;
for (int i = 0; i < d->particles.count(); ++i) {
const QDeclarativeParticle &particle = d->particles.at(i);
-#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
pixmapData[i].x = particle.x - myX + halfPWidth;
pixmapData[i].y = particle.y - myY + halfPHeight;
-#else
- pixmapData[i].point = QPointF(particle.x - myX + halfPWidth, particle.y - myY + halfPHeight);
-#endif
pixmapData[i].opacity = particle.opacity;
//these never change
pixmapData[i].rotation = 0;
pixmapData[i].scaleX = 1;
pixmapData[i].scaleY = 1;
-#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
pixmapData[i].sourceLeft = sourceRect.left();
pixmapData[i].sourceTop = sourceRect.top();
pixmapData[i].width = sourceRect.width();
pixmapData[i].height = sourceRect.height();
-#else
- pixmapData[i].source = sourceRect;
-#endif
}
-#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image);
-#else
- qDrawPixmaps(p, pixmapData.data(), d->particles.count(), d->image);
-#endif
}
void QDeclarativeParticles::componentComplete()