| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicsitemanimation.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | static inline bool check_step_valid(qreal step, const char *method) | - | ||||||||||||
| 11 | { | - | ||||||||||||
| 12 |     if (!(step >= 0
 
  | 0 | ||||||||||||
| 13 | QMessageLogger(__FILE__, 95, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::%s: invalid step = %f", method, step); | - | ||||||||||||
| 14 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 15 | } | - | ||||||||||||
| 16 |     return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||
| 17 | } | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | class QGraphicsItemAnimationPrivate | - | ||||||||||||
| 20 | { | - | ||||||||||||
| 21 | public: | - | ||||||||||||
| 22 | inline QGraphicsItemAnimationPrivate() | - | ||||||||||||
| 23 | : q(0), timeLine(0), item(0), step(0) | - | ||||||||||||
| 24 |     { } never executed:  end of block | 0 | ||||||||||||
| 25 | - | |||||||||||||
| 26 | QGraphicsItemAnimation *q; | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | QPointer<QTimeLine> timeLine; | - | ||||||||||||
| 29 | QGraphicsItem *item; | - | ||||||||||||
| 30 | - | |||||||||||||
| 31 | QPointF startPos; | - | ||||||||||||
| 32 | QMatrix startMatrix; | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | qreal step; | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | struct Pair { | - | ||||||||||||
| 37 | bool operator <(const Pair &other) const | - | ||||||||||||
| 38 |         { return never executed:   step < other.step;return step < other.step;never executed:   }return step < other.step; | 0 | ||||||||||||
| 39 | bool operator==(const Pair &other) const | - | ||||||||||||
| 40 |         { return never executed:   step == other.step;return step == other.step;never executed:   }return step == other.step; | 0 | ||||||||||||
| 41 | qreal step; | - | ||||||||||||
| 42 | qreal value; | - | ||||||||||||
| 43 | }; | - | ||||||||||||
| 44 | QVector<Pair> xPosition; | - | ||||||||||||
| 45 | QVector<Pair> yPosition; | - | ||||||||||||
| 46 | QVector<Pair> rotation; | - | ||||||||||||
| 47 | QVector<Pair> verticalScale; | - | ||||||||||||
| 48 | QVector<Pair> horizontalScale; | - | ||||||||||||
| 49 | QVector<Pair> verticalShear; | - | ||||||||||||
| 50 | QVector<Pair> horizontalShear; | - | ||||||||||||
| 51 | QVector<Pair> xTranslation; | - | ||||||||||||
| 52 | QVector<Pair> yTranslation; | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | qreal linearValueForStep(qreal step, QVector<Pair> *source, qreal defaultValue = 0); | - | ||||||||||||
| 55 | void insertUniquePair(qreal step, qreal value, QVector<Pair> *binList, const char* method); | - | ||||||||||||
| 56 | }; | - | ||||||||||||
| 57 | template<> class QTypeInfo<QGraphicsItemAnimationPrivate::Pair > { public: enum { isComplex = (((Q_PRIMITIVE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_PRIMITIVE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_PRIMITIVE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QGraphicsItemAnimationPrivate::Pair)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QGraphicsItemAnimationPrivate::Pair >::value, isDummy = (((Q_PRIMITIVE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QGraphicsItemAnimationPrivate::Pair) }; static inline const char *name() { return "QGraphicsItemAnimationPrivate::Pair"; } }; | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | qreal QGraphicsItemAnimationPrivate::linearValueForStep(qreal step, QVector<Pair> *source, qreal defaultValue) | - | ||||||||||||
| 60 | { | - | ||||||||||||
| 61 |     if (source->isEmpty()
  | 0 | ||||||||||||
| 62 |         return never executed:   defaultValue;return defaultValue;never executed:  return defaultValue; | 0 | ||||||||||||
| 63 | step = qMin<qreal>(qMax<qreal>(step, 0), 1); | - | ||||||||||||
| 64 | - | |||||||||||||
| 65 |     if (step == 1
  | 0 | ||||||||||||
| 66 |         return never executed:   source->last().value;return source->last().value;never executed:  return source->last().value; | 0 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | qreal stepBefore = 0; | - | ||||||||||||
| 69 | qreal stepAfter = 1; | - | ||||||||||||
| 70 |     qreal valueBefore = source->first().step == 0
  | 0 | ||||||||||||
| 71 | qreal valueAfter = source->last().value; | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | - | |||||||||||||
| 74 |     for (int i = 0; i < source->size()
 
  | 0 | ||||||||||||
| 75 | stepBefore = source->at(i).step; | - | ||||||||||||
| 76 | valueBefore = source->at(i).value; | - | ||||||||||||
| 77 |     } never executed:  end of block | 0 | ||||||||||||
| 78 | - | |||||||||||||
| 79 | - | |||||||||||||
| 80 |     for (int j = source->size() - 1; j >= 0
 
  | 0 | ||||||||||||
| 81 | stepAfter = source->at(j).step; | - | ||||||||||||
| 82 | valueAfter = source->at(j).value; | - | ||||||||||||
| 83 |     } never executed:  end of block | 0 | ||||||||||||
| 84 | - | |||||||||||||
| 85 | - | |||||||||||||
| 86 |     return never executed:   valueBefore + (valueAfter - valueBefore) * ((step - stepBefore) / (stepAfter - stepBefore));return valueBefore + (valueAfter - valueBefore) * ((step - stepBefore) / (stepAfter - stepBefore));never executed:  return valueBefore + (valueAfter - valueBefore) * ((step - stepBefore) / (stepAfter - stepBefore)); | 0 | ||||||||||||
| 87 | } | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | void QGraphicsItemAnimationPrivate::insertUniquePair(qreal step, qreal value, QVector<Pair> *binList, const char* method) | - | ||||||||||||
| 90 | { | - | ||||||||||||
| 91 |     if (!check_step_valid(step, method)
  | 0 | ||||||||||||
| 92 |         return; never executed:  return; | 0 | ||||||||||||
| 93 | - | |||||||||||||
| 94 | const Pair pair = { step, value }; | - | ||||||||||||
| 95 | - | |||||||||||||
| 96 | const QVector<Pair>::iterator result = std::lower_bound(binList->begin(), binList->end(), pair); | - | ||||||||||||
| 97 |     if (result == binList->end()
 
  | 0 | ||||||||||||
| 98 |         binList->insert(result, pair); never executed:  binList->insert(result, pair); | 0 | ||||||||||||
| 99 | else | - | ||||||||||||
| 100 |         result->value = value; never executed:  result->value = value; | 0 | ||||||||||||
| 101 | } | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | - | |||||||||||||
| 104 | - | |||||||||||||
| 105 | - | |||||||||||||
| 106 | QGraphicsItemAnimation::QGraphicsItemAnimation(QObject *parent) | - | ||||||||||||
| 107 | : QObject(parent), d(new QGraphicsItemAnimationPrivate) | - | ||||||||||||
| 108 | { | - | ||||||||||||
| 109 | d->q = this; | - | ||||||||||||
| 110 | } never executed:  end of block | 0 | ||||||||||||
| 111 | - | |||||||||||||
| 112 | - | |||||||||||||
| 113 | - | |||||||||||||
| 114 | - | |||||||||||||
| 115 | QGraphicsItemAnimation::~QGraphicsItemAnimation() | - | ||||||||||||
| 116 | { | - | ||||||||||||
| 117 | delete d; | - | ||||||||||||
| 118 | } never executed:  end of block | 0 | ||||||||||||
| 119 | - | |||||||||||||
| 120 | - | |||||||||||||
| 121 | - | |||||||||||||
| 122 | - | |||||||||||||
| 123 | - | |||||||||||||
| 124 | - | |||||||||||||
| 125 | QGraphicsItem *QGraphicsItemAnimation::item() const | - | ||||||||||||
| 126 | { | - | ||||||||||||
| 127 |     return never executed:   d->item;return d->item;never executed:  return d->item; | 0 | ||||||||||||
| 128 | } | - | ||||||||||||
| 129 | - | |||||||||||||
| 130 | - | |||||||||||||
| 131 | - | |||||||||||||
| 132 | - | |||||||||||||
| 133 | - | |||||||||||||
| 134 | - | |||||||||||||
| 135 | void QGraphicsItemAnimation::setItem(QGraphicsItem *item) | - | ||||||||||||
| 136 | { | - | ||||||||||||
| 137 | d->item = item; | - | ||||||||||||
| 138 | d->startPos = d->item->pos(); | - | ||||||||||||
| 139 | } never executed:  end of block | 0 | ||||||||||||
| 140 | - | |||||||||||||
| 141 | - | |||||||||||||
| 142 | - | |||||||||||||
| 143 | - | |||||||||||||
| 144 | - | |||||||||||||
| 145 | - | |||||||||||||
| 146 | - | |||||||||||||
| 147 | QTimeLine *QGraphicsItemAnimation::timeLine() const | - | ||||||||||||
| 148 | { | - | ||||||||||||
| 149 |     return never executed:   d->timeLine;return d->timeLine;never executed:  return d->timeLine; | 0 | ||||||||||||
| 150 | } | - | ||||||||||||
| 151 | - | |||||||||||||
| 152 | - | |||||||||||||
| 153 | - | |||||||||||||
| 154 | - | |||||||||||||
| 155 | - | |||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | void QGraphicsItemAnimation::setTimeLine(QTimeLine *timeLine) | - | ||||||||||||
| 159 | { | - | ||||||||||||
| 160 |     if (d->timeLine == timeLine
  | 0 | ||||||||||||
| 161 |         return; never executed:  return; | 0 | ||||||||||||
| 162 |     if (d->timeLine
  | 0 | ||||||||||||
| 163 |         delete d->timeLine; never executed:  delete d->timeLine; | 0 | ||||||||||||
| 164 |     if (!timeLine
  | 0 | ||||||||||||
| 165 |         return; never executed:  return; | 0 | ||||||||||||
| 166 | d->timeLine = timeLine; | - | ||||||||||||
| 167 | connect(timeLine, qFlagLocation("2""valueChanged(qreal)" "\0" __FILE__ ":" "249"), this, qFlagLocation("1""setStep(qreal)" "\0" __FILE__ ":" "249")); | - | ||||||||||||
| 168 | } never executed:  end of block | 0 | ||||||||||||
| 169 | - | |||||||||||||
| 170 | - | |||||||||||||
| 171 | - | |||||||||||||
| 172 | - | |||||||||||||
| 173 | - | |||||||||||||
| 174 | - | |||||||||||||
| 175 | QPointF QGraphicsItemAnimation::posAt(qreal step) const | - | ||||||||||||
| 176 | { | - | ||||||||||||
| 177 | check_step_valid(step, "posAt"); | - | ||||||||||||
| 178 |     return never executed:   QPointF(d->linearValueForStep(step, &d->xPosition, d->startPos.x()),return QPointF(d->linearValueForStep(step, &d->xPosition, d->startPos.x()), d->linearValueForStep(step, &d->yPosition, d->startPos.y()));never executed:  return QPointF(d->linearValueForStep(step, &d->xPosition, d->startPos.x()), d->linearValueForStep(step, &d->yPosition, d->startPos.y())); | 0 | ||||||||||||
| 179 |                    d->linearValueForStep(step, &d->yPosition, d->startPos.y())); never executed:  return QPointF(d->linearValueForStep(step, &d->xPosition, d->startPos.x()), d->linearValueForStep(step, &d->yPosition, d->startPos.y())); | 0 | ||||||||||||
| 180 | } | - | ||||||||||||
| 181 | void QGraphicsItemAnimation::setPosAt(qreal step, const QPointF &pos) | - | ||||||||||||
| 182 | { | - | ||||||||||||
| 183 | d->insertUniquePair(step, pos.x(), &d->xPosition, "setPosAt"); | - | ||||||||||||
| 184 | d->insertUniquePair(step, pos.y(), &d->yPosition, "setPosAt"); | - | ||||||||||||
| 185 | } never executed:  end of block | 0 | ||||||||||||
| 186 | - | |||||||||||||
| 187 | - | |||||||||||||
| 188 | - | |||||||||||||
| 189 | - | |||||||||||||
| 190 | - | |||||||||||||
| 191 | - | |||||||||||||
| 192 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::posList() const | - | ||||||||||||
| 193 | { | - | ||||||||||||
| 194 | QList<QPair<qreal, QPointF> > list; | - | ||||||||||||
| 195 | const int xPosCount = d->xPosition.size(); | - | ||||||||||||
| 196 | list.reserve(xPosCount); | - | ||||||||||||
| 197 |     for (int i = 0; i < xPosCount
  | 0 | ||||||||||||
| 198 |         list << QPair<qreal, QPointF>(d->xPosition.at(i).step, QPointF(d->xPosition.at(i).value, d->yPosition.at(i).value)); never executed:  list << QPair<qreal, QPointF>(d->xPosition.at(i).step, QPointF(d->xPosition.at(i).value, d->yPosition.at(i).value)); | 0 | ||||||||||||
| 199 | - | |||||||||||||
| 200 |     return never executed:   list;return list;never executed:  return list; | 0 | ||||||||||||
| 201 | } | - | ||||||||||||
| 202 | - | |||||||||||||
| 203 | - | |||||||||||||
| 204 | - | |||||||||||||
| 205 | - | |||||||||||||
| 206 | QMatrix QGraphicsItemAnimation::matrixAt(qreal step) const | - | ||||||||||||
| 207 | { | - | ||||||||||||
| 208 | check_step_valid(step, "matrixAt"); | - | ||||||||||||
| 209 | - | |||||||||||||
| 210 | QMatrix matrix; | - | ||||||||||||
| 211 |     if (!d->rotation.isEmpty()
  | 0 | ||||||||||||
| 212 |         matrix.rotate(rotationAt(step)); never executed:  matrix.rotate(rotationAt(step)); | 0 | ||||||||||||
| 213 |     if (!d->verticalScale.isEmpty()
  | 0 | ||||||||||||
| 214 |         matrix.scale(horizontalScaleAt(step), verticalScaleAt(step)); never executed:  matrix.scale(horizontalScaleAt(step), verticalScaleAt(step)); | 0 | ||||||||||||
| 215 |     if (!d->verticalShear.isEmpty()
  | 0 | ||||||||||||
| 216 |         matrix.shear(horizontalShearAt(step), verticalShearAt(step)); never executed:  matrix.shear(horizontalShearAt(step), verticalShearAt(step)); | 0 | ||||||||||||
| 217 |     if (!d->xTranslation.isEmpty()
  | 0 | ||||||||||||
| 218 |         matrix.translate(xTranslationAt(step), yTranslationAt(step)); never executed:  matrix.translate(xTranslationAt(step), yTranslationAt(step)); | 0 | ||||||||||||
| 219 |     return never executed:   matrix;return matrix;never executed:  return matrix; | 0 | ||||||||||||
| 220 | } | - | ||||||||||||
| 221 | - | |||||||||||||
| 222 | - | |||||||||||||
| 223 | - | |||||||||||||
| 224 | - | |||||||||||||
| 225 | - | |||||||||||||
| 226 | - | |||||||||||||
| 227 | qreal QGraphicsItemAnimation::rotationAt(qreal step) const | - | ||||||||||||
| 228 | { | - | ||||||||||||
| 229 | check_step_valid(step, "rotationAt"); | - | ||||||||||||
| 230 |     return never executed:   d->linearValueForStep(step, &d->rotation);return d->linearValueForStep(step, &d->rotation);never executed:  return d->linearValueForStep(step, &d->rotation); | 0 | ||||||||||||
| 231 | } | - | ||||||||||||
| 232 | - | |||||||||||||
| 233 | - | |||||||||||||
| 234 | - | |||||||||||||
| 235 | - | |||||||||||||
| 236 | - | |||||||||||||
| 237 | - | |||||||||||||
| 238 | void QGraphicsItemAnimation::setRotationAt(qreal step, qreal angle) | - | ||||||||||||
| 239 | { | - | ||||||||||||
| 240 | d->insertUniquePair(step, angle, &d->rotation, "setRotationAt"); | - | ||||||||||||
| 241 | } never executed:  end of block | 0 | ||||||||||||
| 242 | - | |||||||||||||
| 243 | - | |||||||||||||
| 244 | - | |||||||||||||
| 245 | - | |||||||||||||
| 246 | - | |||||||||||||
| 247 | - | |||||||||||||
| 248 | QList<QPair<qreal, qreal> > QGraphicsItemAnimation::rotationList() const | - | ||||||||||||
| 249 | { | - | ||||||||||||
| 250 | QList<QPair<qreal, qreal> > list; | - | ||||||||||||
| 251 | const int numRotations = d->rotation.size(); | - | ||||||||||||
| 252 | list.reserve(numRotations); | - | ||||||||||||
| 253 |     for (int i = 0; i < numRotations
  | 0 | ||||||||||||
| 254 |         list << QPair<qreal, qreal>(d->rotation.at(i).step, d->rotation.at(i).value); never executed:  list << QPair<qreal, qreal>(d->rotation.at(i).step, d->rotation.at(i).value); | 0 | ||||||||||||
| 255 | - | |||||||||||||
| 256 |     return never executed:   list;return list;never executed:  return list; | 0 | ||||||||||||
| 257 | } | - | ||||||||||||
| 258 | - | |||||||||||||
| 259 | - | |||||||||||||
| 260 | - | |||||||||||||
| 261 | - | |||||||||||||
| 262 | - | |||||||||||||
| 263 | - | |||||||||||||
| 264 | qreal QGraphicsItemAnimation::xTranslationAt(qreal step) const | - | ||||||||||||
| 265 | { | - | ||||||||||||
| 266 | check_step_valid(step, "xTranslationAt"); | - | ||||||||||||
| 267 |     return never executed:   d->linearValueForStep(step, &d->xTranslation);return d->linearValueForStep(step, &d->xTranslation);never executed:  return d->linearValueForStep(step, &d->xTranslation); | 0 | ||||||||||||
| 268 | } | - | ||||||||||||
| 269 | - | |||||||||||||
| 270 | - | |||||||||||||
| 271 | - | |||||||||||||
| 272 | - | |||||||||||||
| 273 | - | |||||||||||||
| 274 | - | |||||||||||||
| 275 | qreal QGraphicsItemAnimation::yTranslationAt(qreal step) const | - | ||||||||||||
| 276 | { | - | ||||||||||||
| 277 | check_step_valid(step, "yTranslationAt"); | - | ||||||||||||
| 278 |     return never executed:   d->linearValueForStep(step, &d->yTranslation);return d->linearValueForStep(step, &d->yTranslation);never executed:  return d->linearValueForStep(step, &d->yTranslation); | 0 | ||||||||||||
| 279 | } | - | ||||||||||||
| 280 | - | |||||||||||||
| 281 | - | |||||||||||||
| 282 | - | |||||||||||||
| 283 | - | |||||||||||||
| 284 | - | |||||||||||||
| 285 | - | |||||||||||||
| 286 | - | |||||||||||||
| 287 | void QGraphicsItemAnimation::setTranslationAt(qreal step, qreal dx, qreal dy) | - | ||||||||||||
| 288 | { | - | ||||||||||||
| 289 | d->insertUniquePair(step, dx, &d->xTranslation, "setTranslationAt"); | - | ||||||||||||
| 290 | d->insertUniquePair(step, dy, &d->yTranslation, "setTranslationAt"); | - | ||||||||||||
| 291 | } never executed:  end of block | 0 | ||||||||||||
| 292 | - | |||||||||||||
| 293 | - | |||||||||||||
| 294 | - | |||||||||||||
| 295 | - | |||||||||||||
| 296 | - | |||||||||||||
| 297 | - | |||||||||||||
| 298 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::translationList() const | - | ||||||||||||
| 299 | { | - | ||||||||||||
| 300 | QList<QPair<qreal, QPointF> > list; | - | ||||||||||||
| 301 | const int numTranslations = d->xTranslation.size(); | - | ||||||||||||
| 302 | list.reserve(numTranslations); | - | ||||||||||||
| 303 |     for (int i = 0; i < numTranslations
  | 0 | ||||||||||||
| 304 |         list << QPair<qreal, QPointF>(d->xTranslation.at(i).step, QPointF(d->xTranslation.at(i).value, d->yTranslation.at(i).value)); never executed:  list << QPair<qreal, QPointF>(d->xTranslation.at(i).step, QPointF(d->xTranslation.at(i).value, d->yTranslation.at(i).value)); | 0 | ||||||||||||
| 305 | - | |||||||||||||
| 306 |     return never executed:   list;return list;never executed:  return list; | 0 | ||||||||||||
| 307 | } | - | ||||||||||||
| 308 | - | |||||||||||||
| 309 | - | |||||||||||||
| 310 | - | |||||||||||||
| 311 | - | |||||||||||||
| 312 | - | |||||||||||||
| 313 | - | |||||||||||||
| 314 | qreal QGraphicsItemAnimation::verticalScaleAt(qreal step) const | - | ||||||||||||
| 315 | { | - | ||||||||||||
| 316 | check_step_valid(step, "verticalScaleAt"); | - | ||||||||||||
| 317 | - | |||||||||||||
| 318 |     return never executed:   d->linearValueForStep(step, &d->verticalScale, 1);return d->linearValueForStep(step, &d->verticalScale, 1);never executed:  return d->linearValueForStep(step, &d->verticalScale, 1); | 0 | ||||||||||||
| 319 | } | - | ||||||||||||
| 320 | - | |||||||||||||
| 321 | - | |||||||||||||
| 322 | - | |||||||||||||
| 323 | - | |||||||||||||
| 324 | - | |||||||||||||
| 325 | - | |||||||||||||
| 326 | qreal QGraphicsItemAnimation::horizontalScaleAt(qreal step) const | - | ||||||||||||
| 327 | { | - | ||||||||||||
| 328 | check_step_valid(step, "horizontalScaleAt"); | - | ||||||||||||
| 329 |     return never executed:   d->linearValueForStep(step, &d->horizontalScale, 1);return d->linearValueForStep(step, &d->horizontalScale, 1);never executed:  return d->linearValueForStep(step, &d->horizontalScale, 1); | 0 | ||||||||||||
| 330 | } | - | ||||||||||||
| 331 | - | |||||||||||||
| 332 | - | |||||||||||||
| 333 | - | |||||||||||||
| 334 | - | |||||||||||||
| 335 | - | |||||||||||||
| 336 | - | |||||||||||||
| 337 | - | |||||||||||||
| 338 | void QGraphicsItemAnimation::setScaleAt(qreal step, qreal sx, qreal sy) | - | ||||||||||||
| 339 | { | - | ||||||||||||
| 340 | d->insertUniquePair(step, sx, &d->horizontalScale, "setScaleAt"); | - | ||||||||||||
| 341 | d->insertUniquePair(step, sy, &d->verticalScale, "setScaleAt"); | - | ||||||||||||
| 342 | } never executed:  end of block | 0 | ||||||||||||
| 343 | - | |||||||||||||
| 344 | - | |||||||||||||
| 345 | - | |||||||||||||
| 346 | - | |||||||||||||
| 347 | - | |||||||||||||
| 348 | - | |||||||||||||
| 349 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::scaleList() const | - | ||||||||||||
| 350 | { | - | ||||||||||||
| 351 | QList<QPair<qreal, QPointF> > list; | - | ||||||||||||
| 352 | const int numScales = d->horizontalScale.size(); | - | ||||||||||||
| 353 | list.reserve(numScales); | - | ||||||||||||
| 354 |     for (int i = 0; i < numScales
  | 0 | ||||||||||||
| 355 |         list << QPair<qreal, QPointF>(d->horizontalScale.at(i).step, QPointF(d->horizontalScale.at(i).value, d->verticalScale.at(i).value)); never executed:  list << QPair<qreal, QPointF>(d->horizontalScale.at(i).step, QPointF(d->horizontalScale.at(i).value, d->verticalScale.at(i).value)); | 0 | ||||||||||||
| 356 | - | |||||||||||||
| 357 |     return never executed:   list;return list;never executed:  return list; | 0 | ||||||||||||
| 358 | } | - | ||||||||||||
| 359 | - | |||||||||||||
| 360 | - | |||||||||||||
| 361 | - | |||||||||||||
| 362 | - | |||||||||||||
| 363 | - | |||||||||||||
| 364 | - | |||||||||||||
| 365 | qreal QGraphicsItemAnimation::verticalShearAt(qreal step) const | - | ||||||||||||
| 366 | { | - | ||||||||||||
| 367 | check_step_valid(step, "verticalShearAt"); | - | ||||||||||||
| 368 |     return never executed:   d->linearValueForStep(step, &d->verticalShear, 0);return d->linearValueForStep(step, &d->verticalShear, 0);never executed:  return d->linearValueForStep(step, &d->verticalShear, 0); | 0 | ||||||||||||
| 369 | } | - | ||||||||||||
| 370 | - | |||||||||||||
| 371 | - | |||||||||||||
| 372 | - | |||||||||||||
| 373 | - | |||||||||||||
| 374 | - | |||||||||||||
| 375 | - | |||||||||||||
| 376 | qreal QGraphicsItemAnimation::horizontalShearAt(qreal step) const | - | ||||||||||||
| 377 | { | - | ||||||||||||
| 378 | check_step_valid(step, "horizontalShearAt"); | - | ||||||||||||
| 379 |     return never executed:   d->linearValueForStep(step, &d->horizontalShear, 0);return d->linearValueForStep(step, &d->horizontalShear, 0);never executed:  return d->linearValueForStep(step, &d->horizontalShear, 0); | 0 | ||||||||||||
| 380 | } | - | ||||||||||||
| 381 | - | |||||||||||||
| 382 | - | |||||||||||||
| 383 | - | |||||||||||||
| 384 | - | |||||||||||||
| 385 | - | |||||||||||||
| 386 | - | |||||||||||||
| 387 | - | |||||||||||||
| 388 | void QGraphicsItemAnimation::setShearAt(qreal step, qreal sh, qreal sv) | - | ||||||||||||
| 389 | { | - | ||||||||||||
| 390 | d->insertUniquePair(step, sh, &d->horizontalShear, "setShearAt"); | - | ||||||||||||
| 391 | d->insertUniquePair(step, sv, &d->verticalShear, "setShearAt"); | - | ||||||||||||
| 392 | } never executed:  end of block | 0 | ||||||||||||
| 393 | - | |||||||||||||
| 394 | - | |||||||||||||
| 395 | - | |||||||||||||
| 396 | - | |||||||||||||
| 397 | - | |||||||||||||
| 398 | - | |||||||||||||
| 399 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::shearList() const | - | ||||||||||||
| 400 | { | - | ||||||||||||
| 401 | QList<QPair<qreal, QPointF> > list; | - | ||||||||||||
| 402 | const int numShears = d->horizontalShear.size(); | - | ||||||||||||
| 403 | list.reserve(numShears); | - | ||||||||||||
| 404 |     for (int i = 0; i < numShears
  | 0 | ||||||||||||
| 405 |         list << QPair<qreal, QPointF>(d->horizontalShear.at(i).step, QPointF(d->horizontalShear.at(i).value, d->verticalShear.at(i).value)); never executed:  list << QPair<qreal, QPointF>(d->horizontalShear.at(i).step, QPointF(d->horizontalShear.at(i).value, d->verticalShear.at(i).value)); | 0 | ||||||||||||
| 406 | - | |||||||||||||
| 407 |     return never executed:   list;return list;never executed:  return list; | 0 | ||||||||||||
| 408 | } | - | ||||||||||||
| 409 | - | |||||||||||||
| 410 | - | |||||||||||||
| 411 | - | |||||||||||||
| 412 | - | |||||||||||||
| 413 | - | |||||||||||||
| 414 | void QGraphicsItemAnimation::clear() | - | ||||||||||||
| 415 | { | - | ||||||||||||
| 416 | d->xPosition.clear(); | - | ||||||||||||
| 417 | d->yPosition.clear(); | - | ||||||||||||
| 418 | d->rotation.clear(); | - | ||||||||||||
| 419 | d->verticalScale.clear(); | - | ||||||||||||
| 420 | d->horizontalScale.clear(); | - | ||||||||||||
| 421 | d->verticalShear.clear(); | - | ||||||||||||
| 422 | d->horizontalShear.clear(); | - | ||||||||||||
| 423 | d->xTranslation.clear(); | - | ||||||||||||
| 424 | d->yTranslation.clear(); | - | ||||||||||||
| 425 | } never executed:  end of block | 0 | ||||||||||||
| 426 | - | |||||||||||||
| 427 | - | |||||||||||||
| 428 | - | |||||||||||||
| 429 | - | |||||||||||||
| 430 | - | |||||||||||||
| 431 | - | |||||||||||||
| 432 | - | |||||||||||||
| 433 | void QGraphicsItemAnimation::setStep(qreal step) | - | ||||||||||||
| 434 | { | - | ||||||||||||
| 435 |     if (!check_step_valid(step, "setStep")
  | 0 | ||||||||||||
| 436 |         return; never executed:  return; | 0 | ||||||||||||
| 437 | - | |||||||||||||
| 438 | beforeAnimationStep(step); | - | ||||||||||||
| 439 | - | |||||||||||||
| 440 | d->step = step; | - | ||||||||||||
| 441 |     if (d->item
  | 0 | ||||||||||||
| 442 |         if (!d->xPosition.isEmpty()
 
  | 0 | ||||||||||||
| 443 |             d->item->setPos(posAt(step)); never executed:  d->item->setPos(posAt(step)); | 0 | ||||||||||||
| 444 |         if (!d->rotation.isEmpty()
  | 0 | ||||||||||||
| 445 |             || !d->verticalScale.isEmpty()
  | 0 | ||||||||||||
| 446 |             || !d->horizontalScale.isEmpty()
  | 0 | ||||||||||||
| 447 |             || !d->verticalShear.isEmpty()
  | 0 | ||||||||||||
| 448 |             || !d->horizontalShear.isEmpty()
  | 0 | ||||||||||||
| 449 |             || !d->xTranslation.isEmpty()
  | 0 | ||||||||||||
| 450 |             || !d->yTranslation.isEmpty()
  | 0 | ||||||||||||
| 451 | d->item->setMatrix(d->startMatrix * matrixAt(step)); | - | ||||||||||||
| 452 |         } never executed:  end of block | 0 | ||||||||||||
| 453 |     } never executed:  end of block | 0 | ||||||||||||
| 454 | - | |||||||||||||
| 455 | afterAnimationStep(step); | - | ||||||||||||
| 456 | } never executed:  end of block | 0 | ||||||||||||
| 457 | void QGraphicsItemAnimation::reset() | - | ||||||||||||
| 458 | { | - | ||||||||||||
| 459 |     if (!d->item
  | 0 | ||||||||||||
| 460 |         return; never executed:  return; | 0 | ||||||||||||
| 461 | d->startPos = d->item->pos(); | - | ||||||||||||
| 462 | d->startMatrix = d->item->matrix(); | - | ||||||||||||
| 463 | } never executed:  end of block | 0 | ||||||||||||
| 464 | void QGraphicsItemAnimation::beforeAnimationStep(qreal step) | - | ||||||||||||
| 465 | { | - | ||||||||||||
| 466 | (void)step;; | - | ||||||||||||
| 467 | } never executed:  end of block | 0 | ||||||||||||
| 468 | void QGraphicsItemAnimation::afterAnimationStep(qreal step) | - | ||||||||||||
| 469 | { | - | ||||||||||||
| 470 | (void)step;; | - | ||||||||||||
| 471 | } never executed:  end of block | 0 | ||||||||||||
| 472 | - | |||||||||||||
| 473 | - | |||||||||||||
| 474 | - | |||||||||||||
| Switch to Source code | Preprocessed file |