Commit 5671728a authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Fix aligment of text

We are now have three different bounding rectangles,
for selection, the painted content and a combination of the two.

Task-number: QTCREATORBUG-11054
Change-Id: I4e40056f2811eb8e738e571f4a7fded16fa73a68
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent b3ef1737
......@@ -83,27 +83,28 @@ void FormEditorItem::setup()
QRectF FormEditorItem::boundingRect() const
{
return m_paintedBoundingRect;
return m_boundingRect;
}
QPainterPath FormEditorItem::shape() const
{
QPainterPath painterPath;
painterPath.addRect(m_boundingRect);
painterPath.addRect(m_selectionBoundingRect);
return painterPath;
}
bool FormEditorItem::contains(const QPointF &point) const
{
return m_boundingRect.contains(point);
return m_selectionBoundingRect.contains(point);
}
void FormEditorItem::updateGeometry()
{
prepareGeometryChange();
m_boundingRect = qmlItemNode().instanceBoundingRect().adjusted(0, 0, 1., 1.);
m_paintedBoundingRect = qmlItemNode().instancePaintedBoundingRect().united(m_boundingRect);
m_selectionBoundingRect = qmlItemNode().instanceBoundingRect().adjusted(0, 0, 1., 1.);
m_paintedBoundingRect = qmlItemNode().instancePaintedBoundingRect();
m_boundingRect = m_paintedBoundingRect.united(m_selectionBoundingRect);
setTransform(qmlItemNode().instanceTransformWithContentTransform());
//the property for zValue is called z in QGraphicsObject
if (qmlItemNode().instanceValue("z").isValid())
......@@ -304,9 +305,9 @@ void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
paintPlaceHolderForInvisbleItem(painter);
} else {
if (m_blurContent)
painter->drawPixmap(boundingRect().topLeft(), qmlItemNode().instanceBlurredRenderPixmap());
painter->drawPixmap(m_paintedBoundingRect.topLeft(), qmlItemNode().instanceBlurredRenderPixmap());
else
painter->drawPixmap(boundingRect().topLeft(), qmlItemNode().instanceRenderPixmap());
painter->drawPixmap(m_paintedBoundingRect.topLeft(), qmlItemNode().instanceRenderPixmap());
}
if (!qmlItemNode().isRootModelNode())
......
......@@ -126,6 +126,7 @@ private: // variables
QTransform m_inverseAttentionTransform;
QRectF m_boundingRect;
QRectF m_paintedBoundingRect;
QRectF m_selectionBoundingRect;
double m_borderWidth;
bool m_highlightBoundingRect;
bool m_blurContent;
......
Markdown is supported
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