diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp index 8b94cfcb3337886ee68dbfdeddaf76d586395c93..4e0f19c4b5648140e96a1b5ef6a2e99c4b554a0b 100644 --- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp @@ -135,8 +135,6 @@ void DragTool::beginWithPoint(const QPointF &beginPoint) void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos) { - QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); - MetaInfo metaInfo = MetaInfo::global(); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); @@ -151,6 +149,8 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlIt nodeList.append(m_dragNode); view()->setSelectedQmlItemNodes(nodeList); m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList)); + + QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); } void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos) @@ -158,8 +158,6 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode if (!parentNode.isValid()) return; - QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); - MetaInfo metaInfo = MetaInfo::global(); FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode); @@ -171,6 +169,8 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode nodeList.append(m_dragNode); view()->setSelectedQmlItemNodes(nodeList); m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList)); + + QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide(); } FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem) @@ -256,11 +256,11 @@ void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event) QPointF scenePos = event->scenePos(); if (m_dragNode.isValid()) { - FormEditorItem *parentItem = calculateContainer(event->scenePos() - QPoint(2, 2)); + FormEditorItem *parentItem = calculateContainer(event->scenePos() + QPoint(2, 2)); if (!parentItem) { //if there is no parent any more - the use left the scene end(event->scenePos()); - m_dragNode.destroy(); //delete the node then QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::show(); + m_dragNode.destroy(); //delete the node then return; } //move diff --git a/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h b/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h index 3ab1b20376287591c0063914ccd2a163c1f14a5d..263af4c1859b4c192b21305cd899d2c824158175 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h +++ b/src/plugins/qmldesigner/components/itemlibrary/customdraganddrop.h @@ -85,7 +85,11 @@ public: static void hide() { instance()->m_isVisible = false; } static void show() - { instance()->m_isVisible = true; } + { + instance()->m_isVisible = true; + instance()->m_widget->show(); + instance()->m_widget->update(); + } static bool isVisible() { return instance()->m_isVisible; }