本文整理汇总了C++中PropertyEditorValue::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyEditorValue::setName方法的具体用法?C++ PropertyEditorValue::setName怎么用?C++ PropertyEditorValue::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyEditorValue
的用法示例。
在下文中一共展示了PropertyEditorValue::setName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 PropertyEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qmlObjectNode,
const PropertyName &name,
const QVariant &value,
PropertyEditorView *propertyEditor)
{
PropertyName propertyName(name);
propertyName.replace('.', '_');
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(propertyName)));
if (!valueObject) {
valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &backendValuesPropertyMap(), SIGNAL(valueChanged(QString,QVariant)));
QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
backendValuesPropertyMap().insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
}
valueObject->setName(name);
valueObject->setModelNode(qmlObjectNode);
if (qmlObjectNode.propertyAffectedByCurrentState(name) && !(qmlObjectNode.modelNode().property(name).isBindingProperty()))
valueObject->setValue(qmlObjectNode.modelValue(name));
else
valueObject->setValue(value);
if (propertyName != "id" &&
qmlObjectNode.currentState().isBaseState() &&
qmlObjectNode.modelNode().property(propertyName).isBindingProperty()) {
valueObject->setExpression(qmlObjectNode.modelNode().bindingProperty(propertyName).expression());
} else {
valueObject->setExpression(qmlObjectNode.instanceValue(name).toString());
}
}
示例3: createPropertyEditorValue
void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const QString &name, const QVariant &value, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor)
{
QString propertyName(name);
propertyName.replace(QLatin1Char('.'), QLatin1Char('_'));
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(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 != QLatin1String("id") &&
fxObjectNode.currentState().isBaseState() &&
fxObjectNode.modelNode().property(propertyName).isBindingProperty()) {
valueObject->setExpression(fxObjectNode.modelNode().bindingProperty(propertyName).expression());
} else {
valueObject->setExpression(fxObjectNode.instanceValue(name).toString());
}
}
示例4: setupPropertyEditorValue
void PropertyEditorQmlBackend::setupPropertyEditorValue(const PropertyName &name, PropertyEditorView *propertyEditor, const QString &type)
{
QmlDesigner::PropertyName propertyName(name);
propertyName.replace('.', '_');
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(propertyName)));
if (!valueObject) {
valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &backendValuesPropertyMap(), SIGNAL(valueChanged(QString,QVariant)));
QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
backendValuesPropertyMap().insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
}
valueObject->setName(propertyName);
if (type == "QColor")
valueObject->setValue(QVariant("#000000"));
else
valueObject->setValue(QVariant(1));
}
示例5: setupPropertyEditorValue
void setupPropertyEditorValue(const PropertyName &name, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor, const QString &type)
{
QmlDesigner::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(propertyName);
if (type == "QColor")
valueObject->setValue(QVariant("#000000"));
else
valueObject->setValue(QVariant(1));
}
示例6: setup
void PropertyEditorNodeWrapper::setup()
{
Q_ASSERT(m_editorValue);
Q_ASSERT(m_editorValue->modelNode().isValid());
if ((m_editorValue->modelNode().isValid() && m_modelNode.isValid())) {
QmlDesigner::QmlObjectNode fxObjectNode(m_modelNode);
foreach ( const QString &propertyName, m_valuesPropertyMap.keys())
m_valuesPropertyMap.clear(propertyName);
foreach (QObject *object, m_valuesPropertyMap.children())
delete object;
foreach (const QString &propertyName, m_modelNode.metaInfo().propertyNames()) {
if (fxObjectNode.isValid()) {
PropertyEditorValue *valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
valueObject->setName(propertyName);
valueObject->setValue(fxObjectNode.instanceValue(propertyName));
connect(valueObject, SIGNAL(valueChanged(QString, const QVariant&)), &m_valuesPropertyMap, SIGNAL(valueChanged(QString, const QVariant&)));
m_valuesPropertyMap.insert(propertyName, QVariant::fromValue(valueObject));
}
}