forked from qt-creator/qt-creator
Remove addChildNode function
This is a confusing function and not needed anymore.
This commit is contained in:
@@ -195,7 +195,8 @@ void ColorWidget::updateGradientNode()
|
||||
if (m_modelNode.hasProperty("gradient")) {
|
||||
m_modelNode.removeProperty("gradient");
|
||||
}
|
||||
gradientNode = m_modelNode.addChildNode("Qt/Gradient", 4, 6, "gradient");
|
||||
gradientNode = m_modelNode.view()->createModelNode("Qt/Gradient", 4, 6);
|
||||
m_modelNode.nodeProperty("gradient").reparentHere(gradientNode);
|
||||
m_gradientNode = gradientNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,6 @@ public:
|
||||
void setParentProperty(const ModelNode &newParentNode, const QString &propertyName);
|
||||
bool hasParentProperty() const;
|
||||
|
||||
ModelNode addChildNode(const QString &nodeTypeString, int majorVersion, int minorVersion, const QString &propertyName, const PropertyListType &propertyList = PropertyListType());
|
||||
const QList<ModelNode> allDirectSubModelNodes() const;
|
||||
const QList<ModelNode> allSubModelNodes() const;
|
||||
bool hasAnySubModelNodes() const;
|
||||
|
||||
@@ -64,7 +64,6 @@ There is always a root model node in every QmlDesigner::Model:
|
||||
\code
|
||||
QmlDesigner::Model *model = QmlDesigner::Model::create();
|
||||
QmlDesigner::ModelNode rootNode = model->rootNode();
|
||||
QmlDesigner::ModelNode childNode = rootNode.addChildNode("QLineEdit");
|
||||
\endcode
|
||||
|
||||
You can add a property to a node:
|
||||
@@ -321,7 +320,7 @@ ModelNode parentNode4 = node.parentProperty().parentModelNode();
|
||||
parentNode4 == parentNode1; -> true
|
||||
\endcode
|
||||
|
||||
\see parentNode childNodes addChildNode hasChildNodes Model::undo
|
||||
\see parentNode childNodes hasChildNodes Model::undo
|
||||
|
||||
*/
|
||||
|
||||
@@ -354,7 +353,7 @@ void ModelNode::setParentProperty(const ModelNode &newParentNode, const QString
|
||||
|
||||
/*! \brief test if there is a parent for this node
|
||||
\return true is this node has a parent
|
||||
\see childNodes parentNode setParentNode addChildNode hasChildNodes Model::undo
|
||||
\see childNodes parentNode setParentNode hasChildNodes Model::undo
|
||||
*/
|
||||
bool ModelNode::hasParentProperty() const
|
||||
{
|
||||
@@ -574,27 +573,6 @@ void ModelNode::removeProperty(const QString &name)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief creates a new node and add it as child to this node
|
||||
\param nodeTypeString type name of the child node
|
||||
\param propertyList list of properties
|
||||
\return the new created model node
|
||||
|
||||
*/
|
||||
ModelNode ModelNode::addChildNode(const QString &nodeTypeString, int majorVersion, int minorVersion, const QString &propertyName, const PropertyListType &propertyList)
|
||||
{
|
||||
if (!isValid()) {
|
||||
Q_ASSERT_X(isValid(), Q_FUNC_INFO, "model node is invalid");
|
||||
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
|
||||
}
|
||||
|
||||
ModelNode newNode(view()->createModelNode(nodeTypeString, majorVersion, minorVersion, propertyList));
|
||||
|
||||
newNode.setParentProperty(nodeListProperty(propertyName));
|
||||
|
||||
return newNode;
|
||||
}
|
||||
|
||||
/*! \brief removes this node from the node tree
|
||||
*/
|
||||
|
||||
|
||||
@@ -268,7 +268,8 @@ QmlModelState QmlModelStateGroup::addState(const QString &name)
|
||||
PropertyListType propertyList;
|
||||
propertyList.append(qMakePair(QString("name"), QVariant(name)));
|
||||
|
||||
ModelNode newState(modelNode().addChildNode("Qt/State", 4, 6, "states", propertyList));
|
||||
ModelNode newState = modelNode().view()->createModelNode("Qt/State", 4, 6, propertyList);
|
||||
modelNode().nodeListProperty("states").reparentHere(newState);
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,9 @@ void QmlModelState::addChangeSetIfNotExists(const ModelNode &node)
|
||||
return; //changeSet already there
|
||||
}
|
||||
|
||||
ModelNode newChangeSet(modelNode().addChildNode("Qt/PropertyChanges", 4, 6, "changes"));
|
||||
ModelNode newChangeSet = modelNode().view()->createModelNode("Qt/PropertyChanges", 4, 6);
|
||||
modelNode().nodeListProperty("changes").reparentHere(newChangeSet);
|
||||
|
||||
QmlPropertyChanges(newChangeSet).setTarget(node);
|
||||
Q_ASSERT(QmlPropertyChanges(newChangeSet).isValid());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user