forked from qt-creator/qt-creator
QmlDesigner: Fix margins for Group Box
We used the item size for calculation, now we use the content item bounding rectangle. Change-Id: I94ca0565c1c3d992563207ee1cd9c1dcb8c874ea Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -619,14 +619,19 @@ static void adjustAnchorLine(const QmlItemNode &sourceQmlItemNode,
|
||||
if (targetQmlItemNode.isValid() && !targetQmlItemNode.anchors().checkForCycle(lineAnchorLineType, sourceQmlItemNode)) {
|
||||
double margin = 0.0;
|
||||
|
||||
QRectF boundingRect = targetQmlItemNode.instanceContentItemBoundingRect();
|
||||
if (boundingRect.isNull())
|
||||
boundingRect = targetQmlItemNode.instanceBoundingRect();
|
||||
|
||||
if (targetQmlItemNode == containerQmlItemNode) {
|
||||
if (lineAnchorLineType == AnchorLine::Left
|
||||
|| lineAnchorLineType == AnchorLine::Top)
|
||||
margin = fromAnchorLine;
|
||||
if (lineAnchorLineType == AnchorLine::Left)
|
||||
margin = fromAnchorLine - boundingRect.left();
|
||||
else if (lineAnchorLineType == AnchorLine::Top)
|
||||
margin = fromAnchorLine - boundingRect.top();
|
||||
else if (lineAnchorLineType == AnchorLine::Right)
|
||||
margin = targetQmlItemNode.instanceSize().width() - fromAnchorLine;
|
||||
margin = boundingRect.right() - fromAnchorLine;
|
||||
else if (lineAnchorLineType == AnchorLine::Bottom)
|
||||
margin = targetQmlItemNode.instanceSize().height() - fromAnchorLine;
|
||||
margin = boundingRect.bottom() - fromAnchorLine;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user