void NodeAbstractProperty::reparentHere(const ModelNode &modelNode, bool isNodeList) { if (modelNode.parentProperty() == *this) return; Internal::WriteLocker locker(model()); if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); if (isNodeProperty()) { NodeProperty nodeProperty(toNodeProperty()); if (nodeProperty.modelNode().isValid()) throw InvalidReparentingException(__LINE__, __FUNCTION__, __FILE__); } if (modelNode.isAncestorOf(parentModelNode())) throw InvalidReparentingException(__LINE__, __FUNCTION__, __FILE__); if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isNodeAbstractProperty()) model()->d->removeProperty(internalNode()->property(name())); if (modelNode.hasParentProperty()) { Internal::InternalNodeAbstractProperty::Pointer oldParentProperty = modelNode.internalNode()->parentProperty(); model()->d->reparentNode(internalNode(), name(), modelNode.internalNode(), isNodeList); Q_ASSERT(!oldParentProperty.isNull()); } else { model()->d->reparentNode(internalNode(), name(), modelNode.internalNode(), isNodeList); } }
int NodeAbstractProperty::indexOf(const ModelNode &node) const { Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(name()); if (property.isNull()) return 0; return property->indexOf(node.internalNode()); }
void NodeProperty::setModelNode(const ModelNode &modelNode) { if (!isValid()) throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); if (!modelNode.isValid()) throw InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, name()); if (internalNode()->hasProperty(name())) { //check if oldValue != value Internal::InternalProperty::Pointer internalProperty = internalNode()->property(name()); if (internalProperty->isNodeProperty() && internalProperty->toNodeProperty()->node() == modelNode.internalNode()) return; } if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isNodeProperty()) model()->d->removeProperty(internalNode()->property(name())); model()->d->reparentNode(internalNode(), name(), modelNode.internalNode(), false); //### we have to add a flag that this is not a list }
/*! Removes \a node from the selection list. */ void AbstractView::deselectModelNode(const ModelNode &node) { model()->d->deselectNode(node.internalNode()); }
bool AbstractView::isSelectedModelNode(const ModelNode &modelNode) const { return model()->d->selectedNodes().contains(modelNode.internalNode()); }