Commit ded24c39 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Fix d&d in navigator

Check if you want to remove the same node you like to reparent.

Task-number: QTCREATORBUG-12744
Change-Id: Ib098a5723faf1679217f508a73e56359850aa4bc
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 8f3bb642
......@@ -578,10 +578,10 @@ static bool removeModelNodeFromNodeProperty(NodeAbstractProperty &parentProperty
{
if (parentProperty.isNodeProperty()) {
bool removeNodeInPropertySucceeded = true;
bool removeNodeInPropertySucceeded = false;
ModelNode propertyNode = parentProperty.toNodeProperty().modelNode();
// Destruction of ancestors is not allowed
if (!propertyNode.isAncestorOf(modelNode)) {
if (modelNode != propertyNode && !propertyNode.isAncestorOf(modelNode)) {
QApplication::setOverrideCursor(Qt::ArrowCursor);
QMessageBox::StandardButton selectedButton = QMessageBox::warning(Core::ICore::dialogParent(),
......@@ -658,9 +658,8 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty &parentProper
if (nodeCanBeMovedToParentProperty) {
reparentModelNodeToNodeProperty(parentProperty, modelNode);
slideModelNodeInList(parentProperty, modelNode, targetIndex);
}
slideModelNodeInList(parentProperty, modelNode, targetIndex);
}
}
} catch (RewritingException &exception) { //better safe than sorry! There always might be cases where we fail
......@@ -708,7 +707,7 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
ItemLibraryEntry itemLibraryEntry = itemLibraryEntryFromData(mimeData->data("application/vnd.bauhaus.itemlibraryinfo"));
QmlItemNode newQmlItemNode = QmlItemNode::createQmlItemNode(m_view, itemLibraryEntry, QPointF(0., 0.), targetProperty);
if (newQmlItemNode.isValid()) {
if (newQmlItemNode.isValid() && targetProperty.isNodeListProperty()) {
QList<ModelNode> newModelNodeList;
newModelNodeList.append(newQmlItemNode);
......
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