forked from qt-creator/qt-creator
QmlDesigner: Fix shift modifer in layout case
The move tool normally does not reparent, but by pressing shift the user can enforce reparenting. In the drag tool we prefer to reparent to layouts. The shoft modifer disables this heuristic. Task-number: QTCREATORBUG-18737 Change-Id: Ic8041aed537619b16b892a791c0d2bc2390af204 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
360609eb7a
commit
91cda49d7c
@@ -332,7 +332,7 @@ void MoveManipulator::clear()
|
||||
m_beginVerticalCenterHash.clear();
|
||||
}
|
||||
|
||||
void MoveManipulator::reparentTo(FormEditorItem *newParent)
|
||||
void MoveManipulator::reparentTo(FormEditorItem *newParent, ReparentFlag flag)
|
||||
{
|
||||
deleteSnapLines();
|
||||
|
||||
@@ -348,7 +348,8 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent)
|
||||
&& newParent->qmlItemNode().modelNode().hasParentProperty()) {
|
||||
ModelNode grandParent = newParent->qmlItemNode().modelNode().parentProperty().parentModelNode();
|
||||
if (grandParent.metaInfo().isLayoutable()
|
||||
&& !NodeHints::fromModelNode(grandParent).isStackedContainer())
|
||||
&& !NodeHints::fromModelNode(grandParent).isStackedContainer()
|
||||
&& flag == DoNotEnforceReparent)
|
||||
newParent = m_view.data()->scene()->itemForQmlItemNode(QmlItemNode(grandParent));
|
||||
}
|
||||
|
||||
|
@@ -48,6 +48,11 @@ public:
|
||||
UseBaseState
|
||||
};
|
||||
|
||||
enum ReparentFlag {
|
||||
DoNotEnforceReparent,
|
||||
EnforceReparent
|
||||
};
|
||||
|
||||
MoveManipulator(LayerItem *layerItem, FormEditorView *view);
|
||||
~MoveManipulator();
|
||||
void setItems(const QList<FormEditorItem*> &itemList);
|
||||
@@ -57,7 +62,7 @@ public:
|
||||
|
||||
void begin(const QPointF& beginPoint);
|
||||
void update(const QPointF& updatePoint, Snapper::Snapping useSnapping, State stateToBeManipulated = UseCurrentState);
|
||||
void reparentTo(FormEditorItem *newParent);
|
||||
void reparentTo(FormEditorItem *newParent, ReparentFlag flag = DoNotEnforceReparent);
|
||||
void end();
|
||||
void end(Snapper::Snapping useSnapping);
|
||||
|
||||
|
@@ -113,7 +113,7 @@ void MoveTool::mouseMoveEvent(const QList<QGraphicsItem*> &itemList,
|
||||
|
||||
if (m_movingItems.count() > 1
|
||||
|| (movingItem->qmlItemNode().canBereparentedTo(containerItem->qmlItemNode())))
|
||||
m_moveManipulator.reparentTo(containerItem);
|
||||
m_moveManipulator.reparentTo(containerItem, MoveManipulator::EnforceReparent);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user