From a995416473c4837f4fe7fecf13a25ef0336e2a7c Mon Sep 17 00:00:00 2001 From: Thomas Hartmann <Thomas.Hartmann@nokia.com> Date: Tue, 14 Feb 2012 15:48:01 +0100 Subject: [PATCH] QmlDesigner: cleanup Removing some comments... Change-Id: I48dddaf72caea84df883dc9f2f42f2c7eff1c0ce Reviewed-by: Marco Bubke <marco.bubke@nokia.com> --- .../qmldesigner/designercore/model/model.cpp | 73 +------------------ .../designercore/model/modelnode.cpp | 6 +- 2 files changed, 2 insertions(+), 77 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index 7851bd00141..2f3747c2a66 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 8dda7d7d762..6b4881a8326 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()); } -- GitLab