Skip to content
Snippets Groups Projects
Commit 76362232 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.DragAndDrop: avoid flicker

Task-number: BAUHAUS-448
parent bdd62b89
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment