67 When the transformation is applied to a QGraphicsItem, it will be |
67 When the transformation is applied to a QGraphicsItem, it will be |
68 projected back to a 2D QTransform. When multiple QGraphicsTransform |
68 projected back to a 2D QTransform. When multiple QGraphicsTransform |
69 objects are applied to a QGraphicsItem, all of the transformations |
69 objects are applied to a QGraphicsItem, all of the transformations |
70 are computed in true 3D space, with the projection back to 2D |
70 are computed in true 3D space, with the projection back to 2D |
71 only occurring after the last QGraphicsTransform is applied. |
71 only occurring after the last QGraphicsTransform is applied. |
|
72 The exception to this is QGraphicsRotation, which projects back to |
|
73 2D after each rotation to preserve the perspective effect around |
|
74 the X and Y axes. |
72 |
75 |
73 If you want to create your own configurable transformation, you can create |
76 If you want to create your own configurable transformation, you can create |
74 a subclass of QGraphicsTransform (or any or the existing subclasses), and |
77 a subclass of QGraphicsTransform (or any or the existing subclasses), and |
75 reimplement the pure virtual applyTo() function, which takes a pointer to a |
78 reimplement the pure virtual applyTo() function, which takes a pointer to a |
76 QMatrix4x4. Each operation you would like to apply should be exposed as |
79 QMatrix4x4. Each operation you would like to apply should be exposed as |
545 |
548 |
546 if (d->angle == 0. || d->axis.isNull()) |
549 if (d->angle == 0. || d->axis.isNull()) |
547 return; |
550 return; |
548 |
551 |
549 matrix->translate(d->origin); |
552 matrix->translate(d->origin); |
550 QMatrix4x4 m; |
553 matrix->projectedRotate(d->angle, d->axis.x(), d->axis.y(), d->axis.z()); |
551 m.rotate(d->angle, d->axis.x(), d->axis.y(), d->axis.z()); |
|
552 *matrix *= m.toTransform(); |
|
553 matrix->translate(-d->origin); |
554 matrix->translate(-d->origin); |
554 } |
555 } |
555 |
556 |
556 /*! |
557 /*! |
557 \fn void QGraphicsRotation::axisChanged() |
558 \fn void QGraphicsRotation::axisChanged() |