forked from qt-creator/qt-creator
If you move a new item on the formeditor the item is always in the base
state The position is now setted int the base state if you drop a item on the formeditor and move it around. Task-Number: BAUHAUS-644 Reviewed-by: kkoehne
This commit is contained in:
@@ -314,7 +314,7 @@ void DragTool::move(QPointF scenePos)
|
||||
/* if (event->modifiers().testFlag(Qt::ControlModifier) != view()->isSnapButtonChecked())
|
||||
useSnapping = MoveManipulator::UseSnapping;*/
|
||||
|
||||
m_moveManipulator.update(scenePos, useSnapping);
|
||||
m_moveManipulator.update(scenePos, useSnapping, MoveManipulator::UseBaseState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ QList<QRectF> MoveManipulator::tanslatedBoundingRects(const QList<QRectF> &bound
|
||||
/*
|
||||
/brief updates the position of the items.
|
||||
*/
|
||||
void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
|
||||
void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping, State stateToBeManipulated)
|
||||
{
|
||||
deleteSnapLines(); //Since they position is changed and the item is moved the snapping lines are
|
||||
//are obsolete. The new updated snapping lines (color and visibility) will be
|
||||
@@ -226,6 +226,9 @@ void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
|
||||
|
||||
foreach (FormEditorItem* item, m_itemList) {
|
||||
QPointF positionInContainerSpace(m_beginPositionHash.value(item) + offsetVector);
|
||||
|
||||
// don't support anchors for base state because it is not needed by the droptool
|
||||
if (stateToBeManipulated == UseActualState) {
|
||||
QmlAnchors anchors(item->qmlItemNode().anchors());
|
||||
|
||||
if (anchors.instanceHasAnchor(AnchorLine::Top)) {
|
||||
@@ -253,9 +256,11 @@ void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
|
||||
}
|
||||
|
||||
item->qmlItemNode().setPosition(positionInContainerSpace);
|
||||
} else {
|
||||
item->qmlItemNode().modelNode().variantProperty("x").setValue(qRound(positionInContainerSpace.x()));
|
||||
item->qmlItemNode().modelNode().variantProperty("y").setValue(qRound(positionInContainerSpace.y()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,13 +57,18 @@ public:
|
||||
NoSnapping
|
||||
};
|
||||
|
||||
enum State {
|
||||
UseActualState,
|
||||
UseBaseState
|
||||
};
|
||||
|
||||
MoveManipulator(LayerItem *layerItem, FormEditorView *view);
|
||||
~MoveManipulator();
|
||||
void setItems(const QList<FormEditorItem*> &itemList);
|
||||
void setItem(FormEditorItem* item);
|
||||
|
||||
void begin(const QPointF& beginPoint);
|
||||
void update(const QPointF& updatePoint, Snapping useSnapping);
|
||||
void update(const QPointF& updatePoint, Snapping useSnapping, State stateToBeManipulated = UseActualState);
|
||||
void reparentTo(FormEditorItem *newParent);
|
||||
void end(const QPointF& endPoint);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user