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