diff options
author | Marco Bubke <marco.bubke@digia.com> | 2013-05-14 16:21:29 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@digia.com> | 2013-05-14 18:07:15 +0200 |
commit | fc6d51aff103cfad5c64124077bf3e26b987bcd5 (patch) | |
tree | 54c2325464a89778628c101cd5323406a07f4eed /src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp | |
parent | 81cbe76c8502acfa4b17d4376d6202eb7f0ca50f (diff) | |
download | qt-creator-fc6d51aff103cfad5c64124077bf3e26b987bcd5.tar.gz |
QmlDesigner: Support anchoring at snapping
Change-Id: I3ec504e931ee63761538acb4666a3c8ce1a592e5
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp')
-rw-r--r-- | src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp index a258283856..783eb791ee 100644 --- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp @@ -102,7 +102,7 @@ void MoveManipulator::synchronizeParent(const QList<FormEditorItem*> &itemList, } if (!parentNode.metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1)) - update(m_lastPosition, NoSnapping, UseBaseState); + update(m_lastPosition, Snapper::NoSnapping, UseBaseState); } void MoveManipulator::synchronizeInstanceParent(const QList<FormEditorItem*> &itemList) @@ -260,7 +260,7 @@ QHash<FormEditorItem*, QRectF> MoveManipulator::tanslatedBoundingRects(const QHa /* /brief updates the position of the items. */ -void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping, State stateToBeManipulated) +void MoveManipulator::update(const QPointF& updatePoint, Snapper::Snapping useSnapping, State stateToBeManipulated) { m_lastPosition = updatePoint; deleteSnapLines(); //Since they position is changed and the item is moved the snapping lines are @@ -275,12 +275,7 @@ void MoveManipulator::update(const QPointF& updatePoint, Snapping useSnapping, S QPointF offsetVector(updatePointInContainerSpace - beginPointInContainerSpace); - if (useSnapping == UseSnappingAndAnchoring) - { - - } - - if (useSnapping == UseSnapping || useSnapping == UseSnappingAndAnchoring) { + if (useSnapping == Snapper::UseSnapping || useSnapping == Snapper::UseSnappingAndAnchoring) { offsetVector -= findSnappingOffset(tanslatedBoundingRects(m_beginItemRectHash, offsetVector)); generateSnappingLines(tanslatedBoundingRects(m_beginItemRectHash, offsetVector)); } @@ -386,15 +381,25 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent) } } - -void MoveManipulator::end(const QPointF &/*endPoint*/) +void MoveManipulator::end() { m_isActive = false; deleteSnapLines(); -// setOpacityForAllElements(1.0); clear(); } + + +void MoveManipulator::end(Snapper::Snapping useSnapping) +{ + if (useSnapping == Snapper::UseSnappingAndAnchoring) { + foreach (FormEditorItem *formEditorItem, m_itemList) + m_snapper.adjustAnchoringOfItem(formEditorItem); + } + + end(); +} + void MoveManipulator::moveBy(double deltaX, double deltaY) { foreach (FormEditorItem* item, m_itemList) { |