本文整理汇总了C++中ModelNode类的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode类的具体用法?C++ ModelNode怎么用?C++ ModelNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createNodeFromNode
static ModelNode createNodeFromNode(const ModelNode &modelNode,const QHash<QString, QString> &idRenamingHash, AbstractView *view)
{
QList<QPair<QString, QVariant> > propertyList;
QList<QPair<QString, QVariant> > variantPropertyList;
foreach (const VariantProperty &variantProperty, modelNode.variantProperties()) {
propertyList.append(QPair<QString, QVariant>(variantProperty.name(), variantProperty.value()));
}
ModelNode newNode(view->createModelNode(modelNode.type(),modelNode.majorVersion(),modelNode.minorVersion(),
propertyList, variantPropertyList, modelNode.nodeSource(), modelNode.nodeSourceType()));
syncBindingProperties(newNode, modelNode, idRenamingHash);
syncId(newNode, modelNode, idRenamingHash);
syncNodeProperties(newNode, modelNode, idRenamingHash, view);
syncNodeListProperties(newNode, modelNode, idRenamingHash, view);
return newNode;
}
示例2: nodeIdChanged
void ModelToTextMerger::nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId)
{
if (!node.isInHierarchy())
return;
schedule(new ChangeIdRewriteAction(node, oldId, newId));
}
示例3: Q_ASSERT
void NestedListModel::setProperty(int index, const QString& property, const QVariant& value, QList<int> *roles)
{
Q_ASSERT(index >=0 && index < count());
ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index));
bool emitItemsChanged = node->setProperty(property, value);
if (!emitItemsChanged)
return;
int r = roleStrings.indexOf(property);
if (r < 0) {
r = roleStrings.count();
roleStrings << property;
}
roles->append(r);
}
示例4: wantHandleItem
int TextTool::wantHandleItem(const ModelNode &modelNode) const
{
if (modelNode.metaInfo().hasProperty("text"))
return 20;
return 0;
}
示例5: goIntoComponent
void DocumentManager::goIntoComponent(const ModelNode &modelNode)
{
if (modelNode.isValid() && modelNode.isComponent()) {
QmlDesignerPlugin::instance()->viewManager().setComponentNode(modelNode);
if (isFileComponent(modelNode))
openFileComponent(modelNode);
else if (hasDelegateWithFileComponent(modelNode))
openFileComponentForDelegate(modelNode);
else if (hasSourceWithFileComponent(modelNode))
openSourcePropertyOfLoader(modelNode);
else if (isLoaderWithSourceComponent(modelNode))
openComponentSourcePropertyOfLoader(modelNode);
else
openInlineComponent(modelNode);
}
}
示例6: removeSingleNodeFromList
void ComponentView::removeSingleNodeFromList(const ModelNode &node)
{
for (int row = 0; row < m_standardItemModel->rowCount(); row++) {
if (m_standardItemModel->item(row)->data(ModelNodeRole).toInt() == node.internalId())
m_standardItemModel->removeRow(row);
}
}
示例7: ModelStructureTreeNode
ModelStructure::ModelStructure(const ModelNode &node)
: m_latestNode(new ModelStructureTreeNode(node)),
m_latestIndent(0)
{
Q_ASSERT(node.indent()==0);
m_roots << m_latestNode;
}
示例8: wantHandleItem
int ColorTool::wantHandleItem(const ModelNode &modelNode) const
{
if (modelNode.metaInfo().hasProperty("color"))
return 10;
return 0;
}
示例9: nodeCreated
void NodeInstanceView::nodeCreated(const ModelNode &createdNode)
{
NodeInstance instance = loadNode(createdNode);
if (isSkippedNode(createdNode))
return;
QList<VariantProperty> propertyList;
propertyList.append(createdNode.variantProperty("x"));
propertyList.append(createdNode.variantProperty("y"));
updatePosition(propertyList);
nodeInstanceServer()->createInstances(createCreateInstancesCommand(QList<NodeInstance>() << instance));
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(createdNode.variantProperties()));
nodeInstanceServer()->completeComponent(createComponentCompleteCommand(QList<NodeInstance>() << instance));
}
示例10: instanceForModelNode
/*!
Returns the node instance for \a node, which must be valid.
Returns an invalid node instance if no node instance for this model node
exists.
\sa NodeInstance
*/
NodeInstance NodeInstanceView::instanceForModelNode(const ModelNode &node) const
{
Q_ASSERT(node.isValid());
Q_ASSERT(m_nodeInstanceHash.contains(node));
Q_ASSERT(m_nodeInstanceHash.value(node).modelNode() == node);
return m_nodeInstanceHash.value(node);
}
示例11: NodeInstanceServerProxy
void NodeInstanceView::modelAttached(Model *model)
{
AbstractView::modelAttached(model);
m_nodeInstanceServer = new NodeInstanceServerProxy(this, m_runModus, m_currentKit);
m_lastCrashTime.start();
connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(handleChrash()));
if (!isSkippedRootNode(rootModelNode()))
nodeInstanceServer()->createScene(createCreateSceneCommand());
ModelNode stateNode = currentStateNode();
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) {
NodeInstance newStateInstance = instanceForModelNode(stateNode);
activateState(newStateInstance);
}
}
示例12: foreach
void NavigatorTreeModel::propagateInvisible(const ModelNode &node, const bool &invisible)
{
QList <ModelNode> children = node.allDirectSubModelNodes();
foreach (ModelNode child, children) {
child.setAuxiliaryData("childOfInvisible",invisible);
if (!child.auxiliaryData("invisible").toBool())
propagateInvisible(child,invisible);
}
示例13: indexForNode
int ComponentView::indexForNode(const ModelNode &node) const
{
for (int row = 0; row < m_standardItemModel->rowCount(); row++) {
if (m_standardItemModel->item(row)->data(ModelNodeRole).toInt() == node.internalId())
return row;
}
return -1;
}
示例14: acceptedModelNodeChildren
static QList<ModelNode> acceptedModelNodeChildren(const ModelNode &parentNode)
{
QList<ModelNode> children;
PropertyNameList properties;
if (parentNode.metaInfo().hasDefaultProperty())
properties.append(parentNode.metaInfo().defaultPropertyName());
#ifndef DISABLE_VISIBLE_PROPERTIES
properties.append(visibleProperties(parentNode));
#endif
foreach (const PropertyName &propertyName, properties) {
AbstractProperty property(parentNode.property(propertyName));
if (property.isNodeAbstractProperty())
children.append(property.toNodeAbstractProperty().directSubNodes());
}
示例15: indexOf
int NodeAbstractProperty::indexOf(const ModelNode &node) const
{
Internal::InternalNodeAbstractProperty::Pointer property = internalNode()->nodeAbstractProperty(name());
if (property.isNull())
return 0;
return property->indexOf(node.internalNode());
}