diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index 7851bd001411ba2ee4f0694bfce879c442f58972..2f3747c2a6684956a15ef732eb8a9a9365110689 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -1678,40 +1678,7 @@ WriteLocker::~WriteLocker() m_model->m_writeLock = false; } -//static QString anchorLinePropertyValue(const InternalNode::Pointer &sourceNode, const InternalNode::Pointer &targetNode, const AnchorLine::Type &targetType) -//{ -// if (targetNode.isNull() || !targetNode->isValid()) -// return QString(); -// -// if (sourceNode.isNull() || !sourceNode->isValid()) -// return QString(); -// -// if (targetNode == sourceNode) -// return QString(); -// -// QString anchorLineType = InternalNodeAnchors::lineTypeToString(targetType); -// -// // handle "parent" and "parent.something" -// if (targetNode == sourceNode->parentNode()) { -// if (anchorLineType.isNull()) -// return QLatin1String("parent"); -// else -// return QString("parent.%1").arg(anchorLineType); -// } -// -// if (anchorLineType.isNull()) -// return QString(); // for sibling reference, the type cannot be empty anymore. -// -// foreach (const InternalNode::Pointer &sibling, sourceNode->parentNode()->childNodes()) { -// if (sibling == targetNode) { -// return QString("%1.%2").arg(sibling->id(), anchorLineType); -// } -// } -// -// return QString(); -//} - -} +} //namespace internal Model::Model() : @@ -1732,44 +1699,6 @@ Model *Model::create(QString type, int major, int minor, Model *metaInfoPropxyMo return Internal::ModelPrivate::create(type, major, minor, metaInfoPropxyModel); } - -/*! - \brief Creates a model for a component definition - - Creates a model containing the content of a component node. The component node itself is - not part of the newly created model; it's the first item defined after "Component {" - that is the root node. - - \arg componentNode must be valid & of type "Qt/Component" - \return the newly created model. The caller takes ownership of the object life time. - */ -//Model *Model::createComponentModel(const ModelNode &componentNode) -//{ -// -// if (!componentNode.isValid() || componentNode.type() != "Qt/Component") { -// throw new InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, QString("componentNode")); -// } -// -// // the data property does not include the Component element itself -// const TextLocation componentRootLocation -// = componentNode.baseNodeState().m_internalNodeState->propertyLocation("data"); -// -// TextModifier *textModifier -// = new Internal::ComponentTextModifier(d->m_rewriter->textModifier(), -// componentRootLocation, -// d->m_rootInternalNode->baseNodeState()->location()); -// -// QList<QDeclarativeError> errors; -// Model *subModel = create(textModifier, d->m_fileUrl, &errors); -// -// Q_ASSERT(subModel); -// Q_ASSERT(errors.size() == 0); // should never happen, after all it was already compiled! -// -// textModifier->setParent(subModel); -// -// return subModel; -//} - QList<Import> Model::imports() const { return d->imports(); diff --git a/src/plugins/qmldesigner/designercore/model/modelnode.cpp b/src/plugins/qmldesigner/designercore/model/modelnode.cpp index 8dda7d7d762164c186845a160d6b50a40306bf1f..6b4881a8326a7b9d7b7f1c2f7a7d7322935f199d 100644 --- a/src/plugins/qmldesigner/designercore/model/modelnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/modelnode.cpp @@ -286,7 +286,7 @@ A node might become invalid if e.g. it or one of its ancestors is deleted. */ bool ModelNode::isValid() const { - return !m_model.isNull() && !m_view.isNull() && m_internalNode &&m_internalNode->isValid() /*&& model()->metaInfo().hasNodeMetaInfo(m_internalNode->type(), m_internalNode->majorVersion(), m_internalNode->minorVersion())*/; + return !m_model.isNull() && !m_view.isNull() && m_internalNode && m_internalNode->isValid(); } /*! @@ -695,10 +695,6 @@ Internal::InternalNodePointer ModelNode::internalNode() const uint qHash(const ModelNode &node) { -// if (!node.isValid()) { -// Q_ASSERT_X(node.isValid(), Q_FUNC_INFO, "model node is invalid"); -// throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__); -// } return ::qHash(node.internalId()); }