summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-05-05 12:02:54 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2010-05-05 12:34:39 (GMT)
commit66f1a007291209781801a2d3d5f4009bb1963955 (patch)
treef6d45898f097a10215c8a1181740244dabfd8c21 /src/gui/graphicsview/qgraphicsitem.cpp
parentc7ba0460fe21647181d2ff8c812ddea0e74a2768 (diff)
downloadQt-66f1a007291209781801a2d3d5f4009bb1963955.zip
Qt-66f1a007291209781801a2d3d5f4009bb1963955.tar.gz
Qt-66f1a007291209781801a2d3d5f4009bb1963955.tar.bz2
Fixes crash in QGraphicsItem::mouseMove for untransformable items.
Caused by: 253b87180e0a6c5db0feaaed7e321139c4ff1643 Reviewed-by: Yoann
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 81138d9..b8c240a 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7132,7 +7132,11 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
// calculate their diff by mapping viewport coordinates
// directly to parent coordinates.
// COMBINE
- QTransform viewToParentTransform = (item->d_func()->transformData->computedFullTransform().translate(item->d_ptr->pos.x(), item->d_ptr->pos.y()))
+ QTransform itemTransform;
+ if (item->d_ptr->transformData)
+ itemTransform = item->d_ptr->transformData->computedFullTransform();
+ itemTransform.translate(item->d_ptr->pos.x(), item->d_ptr->pos.y());
+ QTransform viewToParentTransform = itemTransform
* (item->sceneTransform() * view->viewportTransform()).inverted();
currentParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->screenPos())));
buttonDownParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->buttonDownScreenPos(Qt::LeftButton))));