diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-04-15 09:58:02 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-04-15 09:58:02 (GMT) |
commit | 0d7f704856166aea83843697ae98bdcf22dbabb0 (patch) | |
tree | 35afd98e122f1ae6e0e6d26365c63e64c982d800 /src | |
parent | 21099dac569348a15df2d6a5a61015b5afa17097 (diff) | |
download | Qt-0d7f704856166aea83843697ae98bdcf22dbabb0.zip Qt-0d7f704856166aea83843697ae98bdcf22dbabb0.tar.gz Qt-0d7f704856166aea83843697ae98bdcf22dbabb0.tar.bz2 |
Clean up and fix bug in merge conflict for 21099dac.
Make use of QPolygonF::translated and QPainterPath::translated to ensure
all mapToParent functions follow the exact same pattern. This makes it
clear that the functions do the same and do it the same way.
Reviewed-by: bnilsen
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 70f5537..7aba576 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -4285,7 +4285,9 @@ QPointF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPointF &point */ QPointF QGraphicsItem::mapToParent(const QPointF &point) const { - return d_ptr->pos + (d_ptr->hasTransform ? transform().map(point) : point); + if (!d_ptr->hasTransform) + return point + d_ptr->pos; + return transform().map(point) + d_ptr->pos; } /*! @@ -4350,9 +4352,9 @@ QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QRectF &rect */ QPolygonF QGraphicsItem::mapToParent(const QRectF &rect) const { - QPolygonF p = !d_ptr->hasTransform ? rect : transform().map(rect); - p.translate(d_ptr->pos); - return p; + if (!d_ptr->hasTransform) + return rect.translated(d_ptr->pos); + return transform().map(rect).translated(d_ptr->pos); } /*! @@ -4551,9 +4553,9 @@ QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPolygonF &p */ QPolygonF QGraphicsItem::mapToParent(const QPolygonF &polygon) const { - QPolygonF p = !d_ptr->hasTransform ? polygon : transform().map(polygon); - p.translate(d_ptr->pos); - return p; + if (!d_ptr->hasTransform) + return polygon.translated(d_ptr->pos); + return transform().map(polygon).translated(d_ptr->pos); } /*! @@ -4595,9 +4597,9 @@ QPainterPath QGraphicsItem::mapToItem(const QGraphicsItem *item, const QPainterP */ QPainterPath QGraphicsItem::mapToParent(const QPainterPath &path) const { - QPainterPath p(path); - p.translate(d_ptr->pos); - return d_ptr->hasTransform ? transform().map(p) : p; + if (!d_ptr->hasTransform) + return path.translated(d_ptr->pos); + return transform().map(path).translated(d_ptr->pos); } /*! |