Qt 4.8
qdeclarativeparticles.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
43 
44 #include <qdeclarativeinfo.h>
45 #include <private/qdeclarativeitem_p.h>
46 
47 #include <private/qdeclarativepixmapcache_p.h>
48 #include <QtCore/QAbstractAnimation>
49 
50 #include <QPainter>
51 #include <QtGui/qdrawutil.h>
52 #include <QVarLengthArray>
53 
54 #include <stdlib.h>
55 #include <math.h>
56 
57 #ifndef M_PI
58 #define M_PI 3.14159265358979323846
59 #define M_PI_2 (M_PI / 2.)
60 #endif
61 #ifndef INT_MAX
62 #define INT_MAX 2147483647
63 #endif
64 
66 #define PI_SQR 9.8696044
67 // parabolic approximation
68 inline qreal fastSin(qreal theta)
69 {
70  const qreal b = 4 / M_PI;
71  const qreal c = -4 / PI_SQR;
72 
73  qreal y = b * theta + c * theta * qAbs(theta);
74  return y;
75 }
76 
77 inline qreal fastCos(qreal theta)
78 {
79  theta += M_PI_2;
80  if (theta > M_PI)
81  theta -= 2 * M_PI;
82 
83  return fastSin(theta);
84 }
85 
87 {
88 public:
89  QDeclarativeParticle(int time) : lifeSpan(1000), fadeOutAge(800)
90  , opacity(0), birthTime(time), x_velocity(0), y_velocity(0)
91  , state(FadeIn), data(0)
92  {
93  }
94 
95  int lifeSpan;
103  enum State { FadeIn, Solid, FadeOut };
105  void *data;
106 };
107 
108 //---------------------------------------------------------------------------
109 
126  QObject(parent)
127 {
128 }
129 
135 {
136  Q_UNUSED(particle);
137  Q_UNUSED(interval);
138 }
139 
145 {
146  Q_UNUSED(particle);
147 }
148 
154 {
155  Q_UNUSED(particle);
156 }
157 
175 {
176  p.x += interval * p.x_velocity;
177  p.y += interval * p.y_velocity;
178 }
179 
241 {
242  if (qFuzzyCompare(x, _xAttr))
243  return;
244  _xAttr = x;
245  emit xattractorChanged();
246 }
247 
249 {
250  if (qFuzzyCompare(y, _yAttr))
251  return;
252  _yAttr = y;
253  emit yattractorChanged();
254 }
255 
257 {
258  qreal scaledAccel = accel/1000000.0;
259  if (qFuzzyCompare(scaledAccel, _accel))
260  return;
261  _accel = scaledAccel;
262  emit accelerationChanged();
263 }
264 
266 {
267  qreal xdiff = _xAttr - p.x;
268  qreal ydiff = _yAttr - p.y;
269  qreal absXdiff = qAbs(xdiff);
270  qreal absYdiff = qAbs(ydiff);
271 
272  qreal xcomp = xdiff / (absXdiff + absYdiff);
273  qreal ycomp = ydiff / (absXdiff + absYdiff);
274 
275  p.x_velocity += xcomp * _accel * interval;
276  p.y_velocity += ycomp * _accel * interval;
277 
278  p.x += interval * p.x_velocity;
279  p.y += interval * p.y_velocity;
280 }
281 
343 {
344  if (!particles)
345  particles = qobject_cast<QDeclarativeParticles*>(parent());
346  if (particles) {
347  Data *d = (Data*)p.data;
348  if (_xvariance != 0.) {
349  qreal xdiff = p.x_velocity - d->x_targetV;
350  if ((xdiff > d->x_peak && d->x_var > 0.0) || (xdiff < -d->x_peak && d->x_var < 0.0)) {
351  d->x_var = -d->x_var;
352  d->x_peak = _xvariance + _xvariance * qreal(qrand()) / RAND_MAX;
353  }
354  p.x_velocity += d->x_var * interval;
355  }
356  p.x += interval * p.x_velocity;
357 
358  if (_yvariance != 0.) {
359  qreal ydiff = p.y_velocity - d->y_targetV;
360  if ((ydiff > d->y_peak && d->y_var > 0.0) || (ydiff < -d->y_peak && d->y_var < 0.0)) {
361  d->y_var = -d->y_var;
362  d->y_peak = _yvariance + _yvariance * qreal(qrand()) / RAND_MAX;
363  }
364  p.y_velocity += d->y_var * interval;
365  }
366  p.y += interval * p.y_velocity;
367  }
368 }
369 
371 {
372  if (!p.data) {
373  Data *d = new Data;
374  p.data = (void*)d;
375  d->x_targetV = p.x_velocity;
376  d->y_targetV = p.y_velocity;
377  d->x_peak = _xvariance;
378  d->y_peak = _yvariance;
379  d->x_var = _pace * qreal(qrand()) / RAND_MAX / 1000.0;
380  d->y_var = _pace * qreal(qrand()) / RAND_MAX / 1000.0;
381  }
382 }
383 
385 {
386  if (p.data)
387  delete (Data*)p.data;
388 }
389 
391 {
392  qreal scaledVar = var / 1000.0;
393  if (qFuzzyCompare(scaledVar, _xvariance))
394  return;
395  _xvariance = scaledVar;
396  emit xvarianceChanged();
397 }
398 
400 {
401  qreal scaledVar = var / 1000.0;
402  if (qFuzzyCompare(scaledVar, _yvariance))
403  return;
404  _yvariance = scaledVar;
405  emit yvarianceChanged();
406 }
407 
409 {
410  qreal scaledPace = pace / 1000.0;
411  if (qFuzzyCompare(scaledPace, _pace))
412  return;
413  _pace = scaledPace;
414  emit paceChanged();
415 }
416 
417 //---------------------------------------------------------------------------
419 {
420 public:
422  : QDeclarativeItem(parent), d(p)
423  {
424  setFlag(QGraphicsItem::ItemHasNoContents, false);
425  maxX = minX = maxY = minY = 0;
426  }
427 
428  void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
429 
430  void updateSize();
431 
437 };
438 
439 //an animation that just gives a tick
440 template<class T, void (T::*method)(int)>
442 {
443 public:
445  virtual int duration() const { return -1; }
446 protected:
447  virtual void updateCurrentTime(int msec) { (m_p->*method)(msec); }
448 
449 private:
450  T *m_p;
451 };
452 
453 //---------------------------------------------------------------------------
455 {
457 public:
459  : count(1), emissionRate(-1), emissionVariance(0.5), lifeSpan(1000)
460  , lifeSpanDev(1000), fadeInDur(200), fadeOutDur(300)
461  , angle(0), angleDev(0), velocity(0), velocityDev(0), emissionCarry(0.)
462  , addParticleTime(0), addParticleCount(0), lastAdvTime(0)
463  , motion(0), clock(this)
464  {
465  }
466 
468  {
469  }
470 
471  void init()
472  {
474  paintItem = new QDeclarativeParticlesPainter(this, q);
475  }
476 
477  void tick(int time);
478  void createParticle(int time);
479  void updateOpacity(QDeclarativeParticle &p, int age);
480 
483  int count;
486  int lifeSpan;
500 
501 
502  QList<QPair<int, int> > bursts;//countLeft, emissionRate pairs
505 
506 };
507 
509 {
511  if (!motion)
512  motion = new QDeclarativeParticleMotionLinear(q);
513 
514  int oldCount = particles.count();
515  int removed = 0;
516  int interval = time - lastAdvTime;
517  for (int i = 0; i < particles.count(); ) {
518  QDeclarativeParticle &particle = particles[i];
519  int age = time - particle.birthTime;
520  if (age >= particle.lifeSpan) {
521  QDeclarativeParticle part = particles.takeAt(i);
522  motion->destroy(part);
523  ++removed;
524  } else {
525  updateOpacity(particle, age);
526  motion->advance(particle, interval);
527  ++i;
528  }
529  }
530 
531  if(emissionRate == -1)//Otherwise leave emission to the emission rate
532  while(removed-- && ((count == -1) || particles.count() < count))
533  createParticle(time);
534 
535  if (!addParticleTime)
536  addParticleTime = time;
537 
538  //Possibly emit new particles
539  if (((count == -1) || particles.count() < count) && emissionRate
540  && !(count==-1 && emissionRate==-1)) {
541  int emissionCount = -1;
542  if (emissionRate != -1){
543  qreal variance = 1.;
544  if (emissionVariance > 0.){
545  variance += (qreal(qrand())/RAND_MAX) * emissionVariance * (qrand()%2?-1.:1.);
546  }
547  qreal emission = emissionRate * (qreal(interval)/1000.);
548  emission = emission * variance + emissionCarry;
549  double tmpDbl;
550  emissionCarry = modf(emission, &tmpDbl);
551  emissionCount = (int)tmpDbl;
552  emissionCount = qMax(0,emissionCount);
553  }
554  while(((count == -1) || particles.count() < count) &&
555  (emissionRate==-1 || emissionCount--))
556  createParticle(time);
557  }
558 
559  //Deal with emissions from requested bursts
560  for(int i=0; i<bursts.size(); i++){
561  int emission = 0;
562  if(bursts[i].second == -1){
563  emission = bursts[i].first;
564  }else{
565  qreal variance = 1.;
566  if (emissionVariance > 0.){
567  variance += (qreal(qrand())/RAND_MAX) * emissionVariance * (qrand()%2?-1.:1.);
568  }
569  qreal workingEmission = bursts[i].second * (qreal(interval)/1000.);
570  workingEmission *= variance;
571  emission = (int)workingEmission;
572  emission = qMax(emission, 0);
573  }
574  emission = qMin(emission, bursts[i].first);
575  bursts[i].first -= emission;
576  while(emission--)
577  createParticle(time);
578  }
579  for(int i=bursts.size()-1; i>=0; i--)
580  if(bursts[i].first <= 0)
581  bursts.removeAt(i);
582 
583  lastAdvTime = time;
584  paintItem->updateSize();
585  paintItem->update();
586  if (!(oldCount || particles.count()) && (!count || !emissionRate) && bursts.isEmpty()) {
587  lastAdvTime = 0;
588  clock.stop();
589  }
590 }
591 
593 {
595  QDeclarativeParticle p(time);
596  p.x = q->x() + q->width() * qreal(qrand()) / RAND_MAX - image.width()/2.0;
597  p.y = q->y() + q->height() * qreal(qrand()) / RAND_MAX - image.height()/2.0;
598  p.lifeSpan = lifeSpan;
599  if (lifeSpanDev)
600  p.lifeSpan += int(lifeSpanDev/2 - lifeSpanDev * qreal(qrand()) / RAND_MAX);
601  p.fadeOutAge = p.lifeSpan - fadeOutDur;
602  if (fadeInDur == 0.) {
604  p.opacity = 1.0;
605  }
606  qreal a = angle;
607  if (angleDev)
608  a += angleDev/2 - angleDev * qreal(qrand()) / RAND_MAX;
609  if (a > M_PI)
610  a = a - 2 * M_PI;
611  qreal v = velocity;
612  if (velocityDev)
613  v += velocityDev/2 - velocityDev * qreal(qrand()) / RAND_MAX;
614  p.x_velocity = v * fastCos(a);
615  p.y_velocity = v * fastSin(a);
616  particles.append(p);
617  motion->created(particles.last());
618 }
619 
621 {
622  switch (p.state) {
624  if (age <= fadeInDur) {
625  p.opacity = qreal(age) / fadeInDur;
626  break;
627  } else {
628  p.opacity = 1.0;
630  // Fall through
631  }
633  if (age <= p.fadeOutAge) {
634  break;
635  } else {
637  // Fall through
638  }
640  p.opacity = qreal(p.lifeSpan - age) / fadeOutDur;
641  break;
642  }
643 }
644 
724 {
726  d->init();
727 }
728 
730 {
731 }
732 
749 {
750  Q_D(const QDeclarativeParticles);
751  return d->url;
752 }
753 
755 {
757  if (d->image.isError())
758  qmlInfo(this) << d->image.error();
759  d->paintItem->updateSize();
760  d->paintItem->update();
761 }
762 
764 {
766 
767  if ((d->url.isEmpty() == name.isEmpty()) && name == d->url)
768  return;
769 
770  if (name.isEmpty()) {
771  d->url = name;
772  d->image.clear(this);
773  d->paintItem->updateSize();
774  d->paintItem->update();
775  } else {
776  d->url = name;
777  Q_ASSERT(!name.isRelative());
778  d->image.load(qmlEngine(this), d->url);
779  if (d->image.isLoading()) {
780  d->image.connectFinished(this, SLOT(imageLoaded()));
781  } else {
782  if (d->image.isError())
783  qmlInfo(this) << d->image.error();
784  //### unify with imageLoaded
785  d->paintItem->updateSize();
786  d->paintItem->update();
787  }
788  }
790 }
791 
820 {
821  Q_D(const QDeclarativeParticles);
822  return d->count;
823 }
824 
826 {
828  if (cnt == d->count)
829  return;
830 
831  int oldCount = d->count;
832  d->count = cnt;
833  d->addParticleTime = 0;
834  d->addParticleCount = d->particles.count();
835  if (!oldCount && d->clock.state() != QAbstractAnimation::Running && d->count && d->emissionRate) {
836  d->clock.start();
837  }
838  d->paintItem->updateSize();
839  d->paintItem->update();
840  emit countChanged();
841 }
842 
843 
872 {
873  Q_D(const QDeclarativeParticles);
874  return d->emissionRate;
875 }
877 {
879  if(er == d->emissionRate)
880  return;
881  d->emissionRate = er;
882  if (d->clock.state() != QAbstractAnimation::Running && d->count && d->emissionRate) {
883  d->clock.start();
884  }
886 }
887 
925 {
926  Q_D(const QDeclarativeParticles);
927  return d->emissionVariance;
928 }
929 
931 {
933  if(d->emissionVariance == ev)
934  return;
935  d->emissionVariance = ev;
937 }
938 
975 {
976  Q_D(const QDeclarativeParticles);
977  return d->lifeSpan;
978 }
979 
981 {
983  if(d->lifeSpan == ls)
984  return;
985  d->lifeSpan = ls;
987 }
988 
1011 {
1012  Q_D(const QDeclarativeParticles);
1013  return d->lifeSpanDev;
1014 }
1015 
1017 {
1019  if(d->lifeSpanDev == dev)
1020  return;
1021  d->lifeSpanDev = dev;
1023 }
1024 
1046 {
1047  Q_D(const QDeclarativeParticles);
1048  return d->fadeInDur;
1049 }
1050 
1052 {
1054  if (dur < 0.0 || dur == d->fadeInDur)
1055  return;
1056  d->fadeInDur = dur;
1058 }
1059 
1070 {
1071  Q_D(const QDeclarativeParticles);
1072  return d->fadeOutDur;
1073 }
1074 
1076 {
1078  if (dur < 0.0 || d->fadeOutDur == dur)
1079  return;
1080  d->fadeOutDur = dur;
1082 }
1083 
1116 {
1117  Q_D(const QDeclarativeParticles);
1118  return d->angle * 180.0 / M_PI;
1119 }
1120 
1122 {
1124  qreal radAngle = angle * M_PI / 180.0;
1125  if(radAngle == d->angle)
1126  return;
1127  d->angle = radAngle;
1128  emit angleChanged();
1129 }
1130 
1153 {
1154  Q_D(const QDeclarativeParticles);
1155  return d->angleDev * 180.0 / M_PI;
1156 }
1157 
1159 {
1161  qreal radDev = dev * M_PI / 180.0;
1162  if(radDev == d->angleDev)
1163  return;
1164  d->angleDev = radDev;
1166 }
1167 
1200 {
1201  Q_D(const QDeclarativeParticles);
1202  return d->velocity * 1000.0;
1203 }
1204 
1206 {
1208  qreal realVel = velocity / 1000.0;
1209  if(realVel == d->velocity)
1210  return;
1211  d->velocity = realVel;
1213 }
1214 
1237 {
1238  Q_D(const QDeclarativeParticles);
1239  return d->velocityDev * 1000.0;
1240 }
1241 
1243 {
1245  qreal realDev = velocity / 1000.0;
1246  if(realDev == d->velocityDev)
1247  return;
1248  d->velocityDev = realDev;
1250 }
1251 
1280 {
1281  Q_D(const QDeclarativeParticles);
1282  return d->motion;
1283 }
1284 
1286 {
1288  if (motion == d->motion)
1289  return;
1290  d->motion = motion;
1291  emit motionChanged();
1292 }
1293 
1315 {
1317  d->bursts << qMakePair(count, emissionRate);
1318  if (d->clock.state() != QAbstractAnimation::Running)
1319  d->clock.start();
1320 }
1321 
1323 {
1324  if (!d->componentComplete)
1325  return;
1326 
1327  const int parentX = parentItem()->x();
1328  const int parentY = parentItem()->y();
1329  for (int i = 0; i < d->particles.count(); ++i) {
1330  const QDeclarativeParticle &particle = d->particles.at(i);
1331  if(particle.x > maxX)
1332  maxX = particle.x;
1333  if(particle.x < minX)
1334  minX = particle.x;
1335  if(particle.y > maxY)
1336  maxY = particle.y;
1337  if(particle.y < minY)
1338  minY = particle.y;
1339  }
1340 
1341  int myWidth = (int)(maxX-minX+0.5)+d->image.width();
1342  int myX = (int)(minX - parentX);
1343  int myHeight = (int)(maxY-minY+0.5)+d->image.height();
1344  int myY = (int)(minY - parentY);
1345  setWidth(myWidth);
1346  setHeight(myHeight);
1347  setX(myX);
1348  setY(myY);
1349 }
1350 
1352 {
1353  Q_UNUSED(p);
1354  //painting is done by the ParticlesPainter, so it can have the right size
1355 }
1356 
1358 {
1359  if (d->image.isNull() || d->particles.isEmpty())
1360  return;
1361 
1362  const int myX = x() + parentItem()->x();
1363  const int myY = y() + parentItem()->y();
1364 
1366  pixmapData.resize(d->particles.count());
1367 
1368  const QRectF sourceRect = d->image.rect();
1369  qreal halfPWidth = sourceRect.width()/2.;
1370  qreal halfPHeight = sourceRect.height()/2.;
1371  for (int i = 0; i < d->particles.count(); ++i) {
1372  const QDeclarativeParticle &particle = d->particles.at(i);
1373  pixmapData[i].x = particle.x - myX + halfPWidth;
1374  pixmapData[i].y = particle.y - myY + halfPHeight;
1375  pixmapData[i].opacity = particle.opacity;
1376 
1377  //these never change
1378  pixmapData[i].rotation = 0;
1379  pixmapData[i].scaleX = 1;
1380  pixmapData[i].scaleY = 1;
1381  pixmapData[i].sourceLeft = sourceRect.left();
1382  pixmapData[i].sourceTop = sourceRect.top();
1383  pixmapData[i].width = sourceRect.width();
1384  pixmapData[i].height = sourceRect.height();
1385  }
1386  p->drawPixmapFragments(pixmapData.data(), d->particles.count(), d->image);
1387 }
1388 
1390 {
1393  if (d->count && d->emissionRate) {
1394  d->paintItem->updateSize();
1395  d->clock.start();
1396  }
1397  if (d->lifeSpanDev > d->lifeSpan)
1398  d->lifeSpanDev = d->lifeSpan;
1399 }
1400 
QDeclarativeParticleMotion(QObject *parent=0)
Constructs a QDeclarativeParticleMotion with parent object parent.
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
void resize(int size)
double d
Definition: qnumeric_p.h:62
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
QList< QDeclarativeParticle > particles
virtual void updateCurrentTime(int msec)
This pure virtual function is called every time the animation&#39;s currentTime changes.
void drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, PixmapFragmentHints hints=0)
This function is used to draw pixmap, or a sub-rectangle of pixmap, at multiple positions with differ...
Definition: qpainter.cpp:9697
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QDeclarativeParserStatus ** d
TickAnimationProxy(T *p, QObject *parent=0)
The QDeclarativeParticleMotion class is the base class for particle motion.
virtual void created(QDeclarativeParticle &)
The particle has just been created.
void setMotion(QDeclarativeParticleMotion *)
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
Definition: qurl.cpp:4317
#define SLOT(a)
Definition: qobjectdefs.h:226
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
qreal fastCos(qreal theta)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
qreal velocity() const
static Q_DECL_CONSTEXPR bool qFuzzyCompare(double p1, double p2)
Definition: qglobal.h:2030
long ASN1_INTEGER_get ASN1_INTEGER * a
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
T * qobject_cast(QObject *object)
Definition: qobject.h:375
Q_CORE_EXPORT int qrand()
int emissionRate() const
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_D(Class)
Definition: qglobal.h:2482
bool isRelative() const
Returns true if the URL is relative; otherwise returns false.
Definition: qurl.cpp:5880
QDeclarativeParticles(QDeclarativeItem *parent=0)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
virtual void advance(QDeclarativeParticle &, int interval)
Move the particle to its new position.
QDeclarativeParticlesPainter * paintItem
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual int duration() const
virtual void componentComplete()=0
Invoked after the root component that caused this instantiation has completed construction.
QDeclarativeParticleMotion * motion() const
qreal emissionVariance() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
The QDeclarativeItem class provides the most basic of all visual items in QML.
QList< QPair< int, int > > bursts
int fadeOutDuration() const
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
const char * name
#define emit
Definition: qobjectdefs.h:76
qreal angle() const
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
virtual void destroy(QDeclarativeParticle &)
The particle is about to be destroyed.
virtual void destroy(QDeclarativeParticle &)
The particle is about to be destroyed.
#define M_PI_2
The State element defines configurations of objects and properties.
The QAbstractAnimation class is the base of all animations.
void setX(qreal x)
Set&#39;s the x coordinate of the item&#39;s position.
QDeclarativeParticlesPainter(QDeclarativeParticlesPrivate *p, QDeclarativeItem *parent)
void updateOpacity(QDeclarativeParticle &p, int age)
qreal angle(const QPointF &p1, const QPointF &p2)
void burst(int count, int emissionRate=-1)
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
#define PI_SQR
qreal y() const
This convenience function is equivalent to calling pos().
QDeclarativeItem * parentItem() const
Returns the QDeclarativeItem parent of this item.
Q_DECLARATIVE_EXPORT QDeclarativeEngine * qmlEngine(const QObject *)
virtual void created(QDeclarativeParticle &)
The particle has just been created.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
qreal x() const
This convenience function is equivalent to calling pos().
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Definition: qpair.h:102
void setY(qreal y)
Set&#39;s the y coordinate of the item&#39;s position.
virtual void advance(QDeclarativeParticle &, int interval)
Move the particle to its new position.
virtual void componentComplete()
if(void) toggleToolbarShown
int fadeInDuration() const
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
virtual void advance(QDeclarativeParticle &, int interval)
Move the particle to its new position.
QDeclarativeParticlesPrivate * d
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
#define M_PI
QDeclarativeInfo qmlInfo(const QObject *me)
qreal velocityDeviation() const
virtual void advance(QDeclarativeParticle &, int interval)
Move the particle to its new position.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
Definition: qstyleoption.h:867
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QDeclarativeParticleMotion * motion
qreal fastSin(qreal theta)
qreal angleDeviation() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
TickAnimationProxy< QDeclarativeParticlesPrivate, &QDeclarativeParticlesPrivate::tick > clock
int lifeSpanDeviation() const