forked from qt-creator/qt-creator
QmlDesigner.DragAndDrop: avoid flicker
Task-number: BAUHAUS-448
This commit is contained in:
@@ -135,8 +135,6 @@ void DragTool::beginWithPoint(const QPointF &beginPoint)
|
|||||||
|
|
||||||
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos)
|
void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlItemNode parentNode, QPointF scenePos)
|
||||||
{
|
{
|
||||||
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
|
|
||||||
|
|
||||||
MetaInfo metaInfo = MetaInfo::global();
|
MetaInfo metaInfo = MetaInfo::global();
|
||||||
|
|
||||||
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
|
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
|
||||||
@@ -151,6 +149,8 @@ void DragTool::createQmlItemNode(const ItemLibraryEntry &itemLibraryEntry, QmlIt
|
|||||||
nodeList.append(m_dragNode);
|
nodeList.append(m_dragNode);
|
||||||
view()->setSelectedQmlItemNodes(nodeList);
|
view()->setSelectedQmlItemNodes(nodeList);
|
||||||
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
|
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
|
||||||
|
|
||||||
|
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos)
|
void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode parentNode, QPointF scenePos)
|
||||||
@@ -158,8 +158,6 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode
|
|||||||
if (!parentNode.isValid())
|
if (!parentNode.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
|
|
||||||
|
|
||||||
MetaInfo metaInfo = MetaInfo::global();
|
MetaInfo metaInfo = MetaInfo::global();
|
||||||
|
|
||||||
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
|
FormEditorItem *parentItem = scene()->itemForQmlItemNode(parentNode);
|
||||||
@@ -171,6 +169,8 @@ void DragTool::createQmlItemNodeFromImage(const QString &imageName, QmlItemNode
|
|||||||
nodeList.append(m_dragNode);
|
nodeList.append(m_dragNode);
|
||||||
view()->setSelectedQmlItemNodes(nodeList);
|
view()->setSelectedQmlItemNodes(nodeList);
|
||||||
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
|
m_selectionIndicator.setItems(scene()->itemsForQmlItemNodes(nodeList));
|
||||||
|
|
||||||
|
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem)
|
FormEditorItem* DragTool::calculateContainer(const QPointF &point, FormEditorItem * currentItem)
|
||||||
@@ -256,11 +256,11 @@ void DragTool::dragMoveEvent(QGraphicsSceneDragDropEvent * event)
|
|||||||
QPointF scenePos = event->scenePos();
|
QPointF scenePos = event->scenePos();
|
||||||
if (m_dragNode.isValid()) {
|
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
|
if (!parentItem) { //if there is no parent any more - the use left the scene
|
||||||
end(event->scenePos());
|
end(event->scenePos());
|
||||||
m_dragNode.destroy(); //delete the node then
|
|
||||||
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::show();
|
QmlDesignerItemLibraryDragAndDrop::CustomDragAndDrop::show();
|
||||||
|
m_dragNode.destroy(); //delete the node then
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//move
|
//move
|
||||||
|
|||||||
@@ -85,7 +85,11 @@ public:
|
|||||||
static void hide()
|
static void hide()
|
||||||
{ instance()->m_isVisible = false; }
|
{ instance()->m_isVisible = false; }
|
||||||
static void show()
|
static void show()
|
||||||
{ instance()->m_isVisible = true; }
|
{
|
||||||
|
instance()->m_isVisible = true;
|
||||||
|
instance()->m_widget->show();
|
||||||
|
instance()->m_widget->update();
|
||||||
|
}
|
||||||
static bool isVisible()
|
static bool isVisible()
|
||||||
{ return instance()->m_isVisible; }
|
{ return instance()->m_isVisible; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user