本文整理汇总了C++中PropertyEditorValue::setModelNode方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyEditorValue::setModelNode方法的具体用法?C++ PropertyEditorValue::setModelNode怎么用?C++ PropertyEditorValue::setModelNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyEditorValue
的用法示例。
在下文中一共展示了PropertyEditorValue::setModelNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor)
{
if (!fxObjectNode.isValid())
return;
QDeclarativeContext *ctxt = m_view->rootContext();
if (fxObjectNode.isValid()) {
foreach (const PropertyName &propertyName, fxObjectNode.modelNode().metaInfo().propertyNames())
createPropertyEditorValue(fxObjectNode, propertyName, fxObjectNode.instanceValue(propertyName), &m_backendValuesPropertyMap, propertyEditor);
// className
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("className")));
if (!valueObject)
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
valueObject->setName("className");
valueObject->setModelNode(fxObjectNode.modelNode());
valueObject->setValue(fxObjectNode.modelNode().simplifiedTypeName());
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
m_backendValuesPropertyMap.insert("className", QVariant::fromValue(valueObject));
// id
valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("id")));
if (!valueObject)
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
valueObject->setName("id");
valueObject->setValue(fxObjectNode.id());
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject));
// anchors
m_backendAnchorBinding.setup(QmlItemNode(fxObjectNode.modelNode()));
ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
ctxt->setContextProperty("transaction", m_propertyEditorTransaction.data());
m_contextObject->setSpecificsUrl(qmlSpecificsFile);
m_contextObject->setStateName(stateName);
if (!fxObjectNode.isValid())
return;
ctxt->setContextProperty("propertyCount", QVariant(fxObjectNode.modelNode().properties().count()));
m_contextObject->setIsBaseState(fxObjectNode.isInBaseState());
m_contextObject->setSelectionChanged(false);
m_contextObject->setSelectionChanged(false);
NodeMetaInfo metaInfo = fxObjectNode.modelNode().metaInfo();
if (metaInfo.isValid()) {
m_contextObject->setMajorVersion(metaInfo.majorVersion());
m_contextObject->setMinorVersion(metaInfo.minorVersion());
} else {
m_contextObject->setMajorVersion(-1);
m_contextObject->setMinorVersion(-1);
}
} else {
示例2: createPropertyEditorValue
void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor)
{
PropertyName propertyName(name);
propertyName.replace('.', '_');
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(propertyMap->value(propertyName)));
if (!valueObject) {
valueObject = new PropertyEditorValue(propertyMap);
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), propertyMap, SIGNAL(valueChanged(QString,QVariant)));
QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
propertyMap->insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
}
valueObject->setName(name);
valueObject->setModelNode(fxObjectNode);
if (fxObjectNode.propertyAffectedByCurrentState(name) && !(fxObjectNode.modelNode().property(name).isBindingProperty()))
valueObject->setValue(fxObjectNode.modelValue(name));
else
valueObject->setValue(value);
if (propertyName != "id" &&
fxObjectNode.currentState().isBaseState() &&
fxObjectNode.modelNode().property(propertyName).isBindingProperty()) {
valueObject->setExpression(fxObjectNode.modelNode().bindingProperty(propertyName).expression());
} else {
valueObject->setExpression(fxObjectNode.instanceValue(name).toString());
}
}