diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-05-14 13:06:48 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-05-14 13:09:22 (GMT) |
commit | 7179792bbbc34a091bfc18ebc3e5bd2e401faa65 (patch) | |
tree | 8838758dff1500af4bcfec1ea189d3494bb819c7 /src/gui/graphicsview/qgraphicsitem.cpp | |
parent | d6e87c332c721bbcb86bebc6f4daa8a3125e80c6 (diff) | |
download | Qt-7179792bbbc34a091bfc18ebc3e5bd2e401faa65.zip Qt-7179792bbbc34a091bfc18ebc3e5bd2e401faa65.tar.gz Qt-7179792bbbc34a091bfc18ebc3e5bd2e401faa65.tar.bz2 |
Fix QGraphicsItem::deviceTransform() to also work with normal items.
QGraphicsItem::deviceTransform() returns the item-to-device transform,
provided with the device-to-scene transform, and combining it with the
item's scene transform. This function is meant to handle items that
enable ItemIgnoresTransformations, but it happened to not work properly
for items that _don't_ enable that flag. Unfortunately this bug is
hard to work around for users from the outside, as it requires you to
check if the item or any ancestor enables ItemIgnoresTransformations.
The fix also removes unnecessary branchs inside QGV so that we use the
same function for all items.
Reviewed-by: bnilsen
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 30c15bc..4908296 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2572,6 +2572,10 @@ QTransform QGraphicsItem::sceneTransform() const */ QTransform QGraphicsItem::deviceTransform(const QTransform &viewportTransform) const { + // Ensure we return the standard transform if we're not untransformable. + if (!d_ptr->itemIsUntransformable()) + return sceneTransform() * viewportTransform; + // Find the topmost item that ignores view transformations. const QGraphicsItem *untransformedAncestor = this; QList<const QGraphicsItem *> parents; |