| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/graphicsview/qgraphicstransform.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | QGraphicsTransformPrivate::~QGraphicsTransformPrivate() | - | ||||||||||||||||||
| 6 | { | - | ||||||||||||||||||
| 7 | } | - | ||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | void QGraphicsTransformPrivate::setItem(QGraphicsItem *i) | - | ||||||||||||||||||
| 10 | { | - | ||||||||||||||||||
| 11 |     if (item == i
  | 0 | ||||||||||||||||||
| 12 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 |     if (item
  | 0 | ||||||||||||||||||
| 15 | QGraphicsTransform * const q = q_func(); | - | ||||||||||||||||||
| 16 | QGraphicsItemPrivate *d_ptr = item->d_ptr.data(); | - | ||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | item->prepareGeometryChange(); | - | ||||||||||||||||||
| 19 | ((!(d_ptr->transformData)) ? qt_assert("d_ptr->transformData",__FILE__,107) : qt_noop()); | - | ||||||||||||||||||
| 20 | d_ptr->transformData->graphicsTransforms.removeAll(q); | - | ||||||||||||||||||
| 21 | d_ptr->dirtySceneTransform = 1; | - | ||||||||||||||||||
| 22 | item = 0; | - | ||||||||||||||||||
| 23 |     } never executed:  end of block | 0 | ||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | item = i; | - | ||||||||||||||||||
| 26 | } never executed:  end of block | 0 | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | void QGraphicsTransformPrivate::updateItem(QGraphicsItem *item) | - | ||||||||||||||||||
| 29 | { | - | ||||||||||||||||||
| 30 | item->prepareGeometryChange(); | - | ||||||||||||||||||
| 31 | item->d_ptr->dirtySceneTransform = 1; | - | ||||||||||||||||||
| 32 | } never executed:  end of block | 0 | ||||||||||||||||||
| 33 | - | |||||||||||||||||||
| 34 | - | |||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | QGraphicsTransform::QGraphicsTransform(QObject *parent) | - | ||||||||||||||||||
| 38 | : QObject(*new QGraphicsTransformPrivate, parent) | - | ||||||||||||||||||
| 39 | { | - | ||||||||||||||||||
| 40 | } never executed:  end of block | 0 | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | - | |||||||||||||||||||
| 45 | QGraphicsTransform::~QGraphicsTransform() | - | ||||||||||||||||||
| 46 | { | - | ||||||||||||||||||
| 47 | QGraphicsTransformPrivate * const d = d_func(); | - | ||||||||||||||||||
| 48 | d->setItem(0); | - | ||||||||||||||||||
| 49 | } never executed:  end of block | 0 | ||||||||||||||||||
| 50 | - | |||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | - | |||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | QGraphicsTransform::QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent) | - | ||||||||||||||||||
| 55 | : QObject(p, parent) | - | ||||||||||||||||||
| 56 | { | - | ||||||||||||||||||
| 57 | } never executed:  end of block | 0 | ||||||||||||||||||
| 58 | void QGraphicsTransform::update() | - | ||||||||||||||||||
| 59 | { | - | ||||||||||||||||||
| 60 | QGraphicsTransformPrivate * const d = d_func(); | - | ||||||||||||||||||
| 61 |     if (d->item
  | 0 | ||||||||||||||||||
| 62 |         d->updateItem(d->item); never executed:  d->updateItem(d->item); | 0 | ||||||||||||||||||
| 63 | } never executed:  end of block | 0 | ||||||||||||||||||
| 64 | class QGraphicsScalePrivate : public QGraphicsTransformPrivate | - | ||||||||||||||||||
| 65 | { | - | ||||||||||||||||||
| 66 | public: | - | ||||||||||||||||||
| 67 | QGraphicsScalePrivate() | - | ||||||||||||||||||
| 68 |         : xScale(1), yScale(1), zScale(1) {} never executed:  end of block | 0 | ||||||||||||||||||
| 69 | QVector3D origin; | - | ||||||||||||||||||
| 70 | qreal xScale; | - | ||||||||||||||||||
| 71 | qreal yScale; | - | ||||||||||||||||||
| 72 | qreal zScale; | - | ||||||||||||||||||
| 73 | }; | - | ||||||||||||||||||
| 74 | - | |||||||||||||||||||
| 75 | - | |||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | QGraphicsScale::QGraphicsScale(QObject *parent) | - | ||||||||||||||||||
| 79 | : QGraphicsTransform(*new QGraphicsScalePrivate, parent) | - | ||||||||||||||||||
| 80 | { | - | ||||||||||||||||||
| 81 | } never executed:  end of block | 0 | ||||||||||||||||||
| 82 | - | |||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | QGraphicsScale::~QGraphicsScale() | - | ||||||||||||||||||
| 87 | { | - | ||||||||||||||||||
| 88 | } | - | ||||||||||||||||||
| 89 | QVector3D QGraphicsScale::origin() const | - | ||||||||||||||||||
| 90 | { | - | ||||||||||||||||||
| 91 | const QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 92 |     return never executed:   d->origin;return d->origin;never executed:  return d->origin; | 0 | ||||||||||||||||||
| 93 | } | - | ||||||||||||||||||
| 94 | void QGraphicsScale::setOrigin(const QVector3D &point) | - | ||||||||||||||||||
| 95 | { | - | ||||||||||||||||||
| 96 | QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 97 |     if (d->origin == point
  | 0 | ||||||||||||||||||
| 98 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 99 | d->origin = point; | - | ||||||||||||||||||
| 100 | update(); | - | ||||||||||||||||||
| 101 | originChanged(); | - | ||||||||||||||||||
| 102 | } never executed:  end of block | 0 | ||||||||||||||||||
| 103 | qreal QGraphicsScale::xScale() const | - | ||||||||||||||||||
| 104 | { | - | ||||||||||||||||||
| 105 | const QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 106 |     return never executed:   d->xScale;return d->xScale;never executed:  return d->xScale; | 0 | ||||||||||||||||||
| 107 | } | - | ||||||||||||||||||
| 108 | void QGraphicsScale::setXScale(qreal scale) | - | ||||||||||||||||||
| 109 | { | - | ||||||||||||||||||
| 110 | QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 111 |     if (d->xScale == scale
  | 0 | ||||||||||||||||||
| 112 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 113 | d->xScale = scale; | - | ||||||||||||||||||
| 114 | update(); | - | ||||||||||||||||||
| 115 | xScaleChanged(); | - | ||||||||||||||||||
| 116 | scaleChanged(); | - | ||||||||||||||||||
| 117 | } never executed:  end of block | 0 | ||||||||||||||||||
| 118 | qreal QGraphicsScale::yScale() const | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | const QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 121 |     return never executed:   d->yScale;return d->yScale;never executed:  return d->yScale; | 0 | ||||||||||||||||||
| 122 | } | - | ||||||||||||||||||
| 123 | void QGraphicsScale::setYScale(qreal scale) | - | ||||||||||||||||||
| 124 | { | - | ||||||||||||||||||
| 125 | QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 126 |     if (d->yScale == scale
  | 0 | ||||||||||||||||||
| 127 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 128 | d->yScale = scale; | - | ||||||||||||||||||
| 129 | update(); | - | ||||||||||||||||||
| 130 | yScaleChanged(); | - | ||||||||||||||||||
| 131 | scaleChanged(); | - | ||||||||||||||||||
| 132 | } never executed:  end of block | 0 | ||||||||||||||||||
| 133 | qreal QGraphicsScale::zScale() const | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | const QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 136 |     return never executed:   d->zScale;return d->zScale;never executed:  return d->zScale; | 0 | ||||||||||||||||||
| 137 | } | - | ||||||||||||||||||
| 138 | void QGraphicsScale::setZScale(qreal scale) | - | ||||||||||||||||||
| 139 | { | - | ||||||||||||||||||
| 140 | QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 141 |     if (d->zScale == scale
  | 0 | ||||||||||||||||||
| 142 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 143 | d->zScale = scale; | - | ||||||||||||||||||
| 144 | update(); | - | ||||||||||||||||||
| 145 | zScaleChanged(); | - | ||||||||||||||||||
| 146 | scaleChanged(); | - | ||||||||||||||||||
| 147 | } never executed:  end of block | 0 | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | void QGraphicsScale::applyTo(QMatrix4x4 *matrix) const | - | ||||||||||||||||||
| 153 | { | - | ||||||||||||||||||
| 154 | const QGraphicsScalePrivate * const d = d_func(); | - | ||||||||||||||||||
| 155 | matrix->translate(d->origin); | - | ||||||||||||||||||
| 156 | matrix->scale(d->xScale, d->yScale, d->zScale); | - | ||||||||||||||||||
| 157 | matrix->translate(-d->origin); | - | ||||||||||||||||||
| 158 | } never executed:  end of block | 0 | ||||||||||||||||||
| 159 | class QGraphicsRotationPrivate : public QGraphicsTransformPrivate | - | ||||||||||||||||||
| 160 | { | - | ||||||||||||||||||
| 161 | public: | - | ||||||||||||||||||
| 162 | QGraphicsRotationPrivate() | - | ||||||||||||||||||
| 163 |         : angle(0), axis(0, 0, 1) {} never executed:  end of block | 0 | ||||||||||||||||||
| 164 | QVector3D origin; | - | ||||||||||||||||||
| 165 | qreal angle; | - | ||||||||||||||||||
| 166 | QVector3D axis; | - | ||||||||||||||||||
| 167 | }; | - | ||||||||||||||||||
| 168 | - | |||||||||||||||||||
| 169 | - | |||||||||||||||||||
| 170 | - | |||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | QGraphicsRotation::QGraphicsRotation(QObject *parent) | - | ||||||||||||||||||
| 173 | : QGraphicsTransform(*new QGraphicsRotationPrivate, parent) | - | ||||||||||||||||||
| 174 | { | - | ||||||||||||||||||
| 175 | } never executed:  end of block | 0 | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | - | |||||||||||||||||||
| 180 | QGraphicsRotation::~QGraphicsRotation() | - | ||||||||||||||||||
| 181 | { | - | ||||||||||||||||||
| 182 | } | - | ||||||||||||||||||
| 183 | QVector3D QGraphicsRotation::origin() const | - | ||||||||||||||||||
| 184 | { | - | ||||||||||||||||||
| 185 | const QGraphicsRotationPrivate * const d = d_func(); | - | ||||||||||||||||||
| 186 |     return never executed:   d->origin;return d->origin;never executed:  return d->origin; | 0 | ||||||||||||||||||
| 187 | } | - | ||||||||||||||||||
| 188 | void QGraphicsRotation::setOrigin(const QVector3D &point) | - | ||||||||||||||||||
| 189 | { | - | ||||||||||||||||||
| 190 | QGraphicsRotationPrivate * const d = d_func(); | - | ||||||||||||||||||
| 191 |     if (d->origin == point
  | 0 | ||||||||||||||||||
| 192 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 193 | d->origin = point; | - | ||||||||||||||||||
| 194 | update(); | - | ||||||||||||||||||
| 195 | originChanged(); | - | ||||||||||||||||||
| 196 | } never executed:  end of block | 0 | ||||||||||||||||||
| 197 | qreal QGraphicsRotation::angle() const | - | ||||||||||||||||||
| 198 | { | - | ||||||||||||||||||
| 199 | const QGraphicsRotationPrivate * const d = d_func(); | - | ||||||||||||||||||
| 200 |     return never executed:   d->angle;return d->angle;never executed:  return d->angle; | 0 | ||||||||||||||||||
| 201 | } | - | ||||||||||||||||||
| 202 | void QGraphicsRotation::setAngle(qreal angle) | - | ||||||||||||||||||
| 203 | { | - | ||||||||||||||||||
| 204 | QGraphicsRotationPrivate * const d = d_func(); | - | ||||||||||||||||||
| 205 |     if (d->angle == angle
  | 0 | ||||||||||||||||||
| 206 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 207 | d->angle = angle; | - | ||||||||||||||||||
| 208 | update(); | - | ||||||||||||||||||
| 209 | angleChanged(); | - | ||||||||||||||||||
| 210 | } never executed:  end of block | 0 | ||||||||||||||||||
| 211 | QVector3D QGraphicsRotation::axis() const | - | ||||||||||||||||||
| 212 | { | - | ||||||||||||||||||
| 213 | const QGraphicsRotationPrivate * const d = d_func(); | - | ||||||||||||||||||
| 214 |     return never executed:   d->axis;return d->axis;never executed:  return d->axis; | 0 | ||||||||||||||||||
| 215 | } | - | ||||||||||||||||||
| 216 | void QGraphicsRotation::setAxis(const QVector3D &axis) | - | ||||||||||||||||||
| 217 | { | - | ||||||||||||||||||
| 218 | QGraphicsRotationPrivate * const d = d_func(); | - | ||||||||||||||||||
| 219 |     if (d->axis == axis
  | 0 | ||||||||||||||||||
| 220 |          return; never executed:  return; | 0 | ||||||||||||||||||
| 221 | d->axis = axis; | - | ||||||||||||||||||
| 222 | update(); | - | ||||||||||||||||||
| 223 | axisChanged(); | - | ||||||||||||||||||
| 224 | } never executed:  end of block | 0 | ||||||||||||||||||
| 225 | void QGraphicsRotation::setAxis(Qt::Axis axis) | - | ||||||||||||||||||
| 226 | { | - | ||||||||||||||||||
| 227 | switch (axis) | - | ||||||||||||||||||
| 228 | { | - | ||||||||||||||||||
| 229 |     case never executed:   Qt::XAxis:case Qt::XAxis:never executed:  case Qt::XAxis: | 0 | ||||||||||||||||||
| 230 | setAxis(QVector3D(1, 0, 0)); | - | ||||||||||||||||||
| 231 |         break; never executed:  break; | 0 | ||||||||||||||||||
| 232 |     case never executed:   Qt::YAxis:case Qt::YAxis:never executed:  case Qt::YAxis: | 0 | ||||||||||||||||||
| 233 | setAxis(QVector3D(0, 1, 0)); | - | ||||||||||||||||||
| 234 |         break; never executed:  break; | 0 | ||||||||||||||||||
| 235 |     case never executed:   Qt::ZAxis:case Qt::ZAxis:never executed:  case Qt::ZAxis: | 0 | ||||||||||||||||||
| 236 | setAxis(QVector3D(0, 0, 1)); | - | ||||||||||||||||||
| 237 |         break; never executed:  break; | 0 | ||||||||||||||||||
| 238 | } | - | ||||||||||||||||||
| 239 | } never executed:  end of block | 0 | ||||||||||||||||||
| 240 | - | |||||||||||||||||||
| 241 | - | |||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const | - | ||||||||||||||||||
| 245 | { | - | ||||||||||||||||||
| 246 | const QGraphicsRotationPrivate * const d = d_func(); | - | ||||||||||||||||||
| 247 | - | |||||||||||||||||||
| 248 |     if (d->angle == 0.
 
 
  | 0 | ||||||||||||||||||
| 249 |         return; never executed:  return; | 0 | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | matrix->translate(d->origin); | - | ||||||||||||||||||
| 252 | matrix->projectedRotate(d->angle, d->axis.x(), d->axis.y(), d->axis.z()); | - | ||||||||||||||||||
| 253 | matrix->translate(-d->origin); | - | ||||||||||||||||||
| 254 | } never executed:  end of block | 0 | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |