diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-19 03:25:38 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-19 03:25:38 (GMT) |
commit | 9e8ff32da0eeaa9dfe03b5ffc123bd6390951494 (patch) | |
tree | 0106b57e45688f273aaed07b761876684a3b4a23 /src/gui/graphicsview/qgraphicsitem_p.h | |
parent | f7af55e67711270286a1addf6a28399982647a62 (diff) | |
download | Qt-9e8ff32da0eeaa9dfe03b5ffc123bd6390951494.zip Qt-9e8ff32da0eeaa9dfe03b5ffc123bd6390951494.tar.gz Qt-9e8ff32da0eeaa9dfe03b5ffc123bd6390951494.tar.bz2 |
Re-implement QGraphicsTransform to use QMatrix4x4
QTransform-based transformations create problems when performing
X and Y axis rotations because they aren't using true 3D. This
change modifies QGraphicsTransform and its sub-classes to use
QMatrix4x4 as the standard transformation matrix, with a project()
function to project back to 2D when required.
Reviewed-by: trustme
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem_p.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 43d690f..38cb757 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -500,16 +500,17 @@ struct QGraphicsItemPrivate::TransformData return transform * *postmultiplyTransform; } - QTransform x(transform); + QMatrix4x4 x(transform); for (int i = 0; i < graphicsTransforms.size(); ++i) graphicsTransforms.at(i)->applyTo(&x); x.translate(xOrigin, yOrigin); - x.rotate(rotation, Qt::ZAxis); - x.scale(scale, scale); + x.rotate(rotation, 0, 0, 1); + x.scale(scale); x.translate(-xOrigin, -yOrigin); + QTransform t = QGraphicsTransform::project(x); if (postmultiplyTransform) - x *= *postmultiplyTransform; - return x; + t *= *postmultiplyTransform; + return t; } }; |