本文整理汇总了C++中ModelNode::hasParentProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::hasParentProperty方法的具体用法?C++ ModelNode::hasParentProperty怎么用?C++ ModelNode::hasParentProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::hasParentProperty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reparentHere
void NodeAbstractProperty::reparentHere(const ModelNode &modelNode, bool isNodeList)
{
if (modelNode.hasParentProperty() && 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);
}
}
示例2: resolveBinding
static ModelNode resolveBinding(const QString &binding, ModelNode currentNode, AbstractView* view)
{
int i = 0;
QString element = binding.split(QLatin1Char('.')).at(0);
while (!element.isEmpty())
{
if (element == "parent") {
if (currentNode.hasParentProperty())
currentNode = currentNode.parentProperty().toNodeAbstractProperty().parentModelNode();
else
return ModelNode(); //binding not valid
} else if (currentNode.hasProperty(element)) {
if (currentNode.property(element).isNodeProperty()) {
currentNode = currentNode.nodeProperty(element).modelNode();
} else {
currentNode = view->modelNodeForId(element); //id
if (!currentNode.isValid())
return ModelNode(); //binding not valid
}
} else {
currentNode = view->modelNodeForId(element); //id
}
i++;
if (i < binding.split(QLatin1Char('.')).count())
element = binding.split(QLatin1Char('.')).at(i);
else
element.clear();
}
return currentNode;
}
示例3: searchForComponentAndAddToList
void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
{
QList<ModelNode> nodeList;
nodeList.append(node);
nodeList.append(node.allSubModelNodes());
foreach (const ModelNode &node, nodeList) {
if (node.nodeSourceType() == ModelNode::NodeWithComponentSource) {
if (!node.id().isEmpty()) {
QStandardItem *item = new QStandardItem(node.id());
item->setData(QVariant::fromValue(node), ModelNodeRole);
item->setEditable(false);
removeSingleNodeFromList(node); //remove node if already present
m_standardItemModel->appendRow(item);
} else {
QString description;
if (node.hasParentProperty()) {
ModelNode parentNode = node.parentProperty().parentModelNode();
if (parentNode.id().isEmpty())
description = parentNode.simplifiedTypeName() + QLatin1Char(' ');
else
description = parentNode.id() + QLatin1Char(' ');
}
description += node.parentProperty().name();
QStandardItem *item = new QStandardItem(description);
item->setData(QVariant::fromValue(node), ModelNodeRole);
item->setEditable(false);
removeSingleNodeFromList(node); //remove node if already present
m_standardItemModel->appendRow(item);
}
}
}
}
示例4: nodeAboutToBeRemoved
void StatesEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
{
if (removedNode.hasParentProperty()) {
const NodeAbstractProperty propertyParent = removedNode.parentProperty();
if (propertyParent.parentModelNode().isRootNode() && propertyParent.name() == "states")
m_lastIndex = propertyParent.indexOf(removedNode);
}
if (currentState().isValid() && removedNode == currentState())
setCurrentState(baseState());
}
示例5: variantPropertyInEditedPath
bool variantPropertyInEditedPath(const VariantProperty &variantProperty, const ModelNode &editingPathViewModelNode)
{
ModelNode pathElementModelNode = variantProperty.parentModelNode();
if (pathElementModelNode.hasParentProperty()) {
if (isInEditedPath(pathElementModelNode.parentProperty(), editingPathViewModelNode))
return true;
}
return false;
}
示例6: componentIdForModelNode
static inline QString componentIdForModelNode(const ModelNode &modelNode)
{
if (modelNode.id().isEmpty()) {
if (modelNode.hasParentProperty()
&& modelNode.parentProperty().name() != "data"
&& modelNode.parentProperty().name() != "children") {
return modelNode.parentProperty().name();
} else {
return modelNode.simplifiedTypeName();
}
} else {
return modelNode.id();
}
}
示例7: nodeOrParentInSet
static bool nodeOrParentInSet(const ModelNode &modelNode, const QSet<ModelNode> &nodeSet)
{
ModelNode currentModelnode = modelNode;
while (currentModelnode.isValid()) {
if (nodeSet.contains(currentModelnode))
return true;
if (!currentModelnode.hasParentProperty())
return false;
currentModelnode = currentModelnode.parentProperty().parentModelNode();
}
return false;
}
示例8: nodeOrParentInSet
static bool nodeOrParentInSet(const ModelNode &node, const QSet<ModelNode> &nodeSet)
{
ModelNode n = node;
while (n.isValid()) {
if (nodeSet.contains(n))
return true;
if (!n.hasParentProperty())
return false;
n = n.parentProperty().parentModelNode();
}
return false;
}
示例9: descriptionForNode
QString ComponentView::descriptionForNode(const ModelNode &node) const
{
QString description;
if (!node.id().isEmpty()) {
description = node.id();
} else if (node.hasParentProperty()) {
ModelNode parentNode = node.parentProperty().parentModelNode();
if (parentNode.id().isEmpty())
description = parentNode.simplifiedTypeName() + QLatin1Char(' ');
else
description = parentNode.id() + QLatin1Char(' ');
description += node.parentProperty().name();
}
return description;
}
示例10: isTabAndParentIsTabView
bool isTabAndParentIsTabView(const ModelNode &modelNode)
{
return modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab", -1, -1)
&& modelNode.hasParentProperty()
&& modelNode.parentProperty().parentModelNode().metaInfo().isSubclassOf("QtQuick.Controls.TabView", -1, -1);
}