Commit 8e9bb261 authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: More cleanup in the drag tool



Change-Id: I52cf75ec558b6f59b731abdca2bbebafb527f181
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent ac7f17c2
...@@ -123,12 +123,12 @@ void DragTool::beginWithPoint(const QPointF &beginPoint) ...@@ -123,12 +123,12 @@ void DragTool::beginWithPoint(const QPointF &beginPoint)
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
const QmlItemNode &parentNode, const QmlItemNode &parentNode,
const QPointF &scenePos) const QPointF &scenePosition)
{ {
MetaInfo metaInfo = MetaInfo::global(); MetaInfo metaInfo = MetaInfo::global();
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
QPointF pos = parentItem->mapFromScene(scenePos); QPointF pos = parentItem->mapFromScene(scenePosition);
m_dragNode = QmlItemNode::createQmlItemNode(view(), itemLibraryEntry, pos, parentNode); m_dragNode = QmlItemNode::createQmlItemNode(view(), itemLibraryEntry, pos, parentNode);
...@@ -139,15 +139,15 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, ...@@ -139,15 +139,15 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry,
void DragTool::createQmlItemNodeFromImage(const QString &imageName, void DragTool::createQmlItemNodeFromImage(const QString &imageName,
const QmlItemNode &parentNode, const QmlItemNode &parentNode,
const QPointF &scenePos) const QPointF &scenePosition)
{ {
if (parentNode.isValid()) { if (parentNode.isValid()) {
MetaInfo metaInfo = MetaInfo::global(); MetaInfo metaInfo = MetaInfo::global();
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
QPointF pos = parentItem->mapFromScene(scenePos); QPointF positonInItemSpace = parentItem->qmlItemNode().instanceSceneTransform().inverted().map(scenePosition);
m_dragNode = QmlItemNode::createQmlItemNodeFromImage(view(), imageName, pos, parentNode); m_dragNode = QmlItemNode::createQmlItemNodeFromImage(view(), imageName, positonInItemSpace, parentNode);
QList<QmlItemNode> nodeList; QList<QmlItemNode> nodeList;
nodeList.append(m_dragNode); nodeList.append(m_dragNode);
...@@ -355,7 +355,7 @@ void DragTool::end(Snapper::Snapping useSnapping) ...@@ -355,7 +355,7 @@ void DragTool::end(Snapper::Snapping useSnapping)
clear(); clear();
} }
void DragTool::move(const QPointF &scenePos, const QList<QGraphicsItem*> &itemList) void DragTool::move(const QPointF &scenePosition, const QList<QGraphicsItem*> &itemList)
{ {
if (m_movingItem) { if (m_movingItem) {
FormEditorItem *containerItem = targetContainerOrRootItem(itemList, m_movingItem.data()); FormEditorItem *containerItem = targetContainerOrRootItem(itemList, m_movingItem.data());
...@@ -367,7 +367,7 @@ void DragTool::move(const QPointF &scenePos, const QList<QGraphicsItem*> &itemL ...@@ -367,7 +367,7 @@ void DragTool::move(const QPointF &scenePos, const QList<QGraphicsItem*> &itemL
Snapper::Snapping useSnapping = Snapper::UseSnapping; Snapper::Snapping useSnapping = Snapper::UseSnapping;
m_moveManipulator.update(scenePos, useSnapping, MoveManipulator::UseBaseState); m_moveManipulator.update(scenePosition, useSnapping, MoveManipulator::UseBaseState);
} }
} }
......
...@@ -73,8 +73,6 @@ public: ...@@ -73,8 +73,6 @@ public:
void beginWithPoint(const QPointF &beginPoint); void beginWithPoint(const QPointF &beginPoint);
//void beginWithPoint(const QPointF &beginPoint);
void clear() QTC_OVERRIDE; void clear() QTC_OVERRIDE;
void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE; void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) QTC_OVERRIDE;
......
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