Commit 80909210 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.instances: ignore infinite/huge bounding rects

There are cases with infinite/huge bounding rects. We ignore those.

Change-Id: If9a55bef91ab5aec4736c579131f4edf10768469
Reviewed-on: http://codereview.qt.nokia.com/1660


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarMarco Bubke <marco.bubke@nokia.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent d53f5958
......@@ -180,6 +180,11 @@ QObject *GraphicsObjectNodeInstance::parent() const
return graphicsObject()->parentItem()->toGraphicsObject();
}
static inline bool isRectangleSane(const QRect &rect)
{
return rect.isValid() && (rect.width() < 10000) && (rec.height() < 10000);
}
QRectF GraphicsObjectNodeInstance::boundingRectWithStepChilds(QGraphicsItem *parentItem) const
{
QRectF boundingRect = parentItem->boundingRect();
......@@ -188,7 +193,8 @@ QRectF GraphicsObjectNodeInstance::boundingRectWithStepChilds(QGraphicsItem *par
QGraphicsObject *childObject = childItem->toGraphicsObject();
if (!(childObject && nodeInstanceServer()->hasInstanceForObject(childObject))) {
QRectF transformedRect = childItem->mapRectToParent(boundingRectWithStepChilds(childItem));
boundingRect = boundingRect.united(transformedRect);
if (isRectangleSane(transformedRect))
boundingRect = boundingRect.united(transformedRect);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment