本文整理汇总了C++中ModelNode::bindingProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::bindingProperty方法的具体用法?C++ ModelNode::bindingProperty怎么用?C++ ModelNode::bindingProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::bindingProperty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isAliasExported
bool QmlObjectNode::isAliasExported() const
{
if (modelNode().isValid() && !modelNode().id().isEmpty()) {
PropertyName modelNodeId = modelNode().id().toUtf8();
ModelNode rootModelNode = view()->rootModelNode();
Q_ASSERT(rootModelNode.isValid());
if (rootModelNode.hasBindingProperty(modelNodeId)
&& rootModelNode.bindingProperty(modelNodeId).isDynamic()
&& rootModelNode.bindingProperty(modelNodeId).expression().toUtf8() == modelNodeId)
return true;
}
return false;
}
示例2: applyProperties
static inline void applyProperties(ModelNode &node, const QHash<PropertyName, QVariant> &propertyHash)
{
QHash<PropertyName, QVariant> auxiliaryData = node.auxiliaryData();
foreach (const PropertyName &propertyName, auxiliaryData.keys()) {
if (node.hasAuxiliaryData(propertyName))
node.setAuxiliaryData(propertyName, QVariant());
}
QHashIterator<PropertyName, QVariant> propertyIterator(propertyHash);
while (propertyIterator.hasNext()) {
propertyIterator.next();
const PropertyName propertyName = propertyIterator.key();
if (propertyName == "width" || propertyName == "height") {
node.setAuxiliaryData(propertyIterator.key(), propertyIterator.value());
} else if (node.property(propertyIterator.key()).isDynamic() &&
node.property(propertyIterator.key()).dynamicTypeName() == "alias" &&
node.property(propertyIterator.key()).isBindingProperty()) {
AbstractProperty targetProperty = node.bindingProperty(propertyIterator.key()).resolveToProperty();
if (targetProperty.isValid())
targetProperty.parentModelNode().setAuxiliaryData(targetProperty.name() + "@NodeInstance", propertyIterator.value());
} else {
node.setAuxiliaryData(propertyIterator.key() + "@NodeInstance", propertyIterator.value());
}
}
}
示例3: ensureAliasExport
void QmlObjectNode::ensureAliasExport()
{
if (!isValid())
throw new InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
if (!isAliasExported()) {
modelNode().validId();
PropertyName modelNodeId = modelNode().id().toUtf8();
ModelNode rootModelNode = view()->rootModelNode();
rootModelNode.bindingProperty(modelNodeId).setDynamicTypeNameAndExpression("alias", modelNodeId);
}
}
示例4: resetVerticalAnchors
void NodeInstanceView::resetVerticalAnchors(const ModelNode &modelNode)
{
QList<BindingProperty> bindingList;
QList<VariantProperty> valueList;
if (modelNode.hasBindingProperty("yx"))
bindingList.append(modelNode.bindingProperty("yx"));
else if (modelNode.hasVariantProperty("y"))
valueList.append(modelNode.variantProperty("y"));
if (modelNode.hasBindingProperty("height"))
bindingList.append(modelNode.bindingProperty("height"));
else if (modelNode.hasVariantProperty("height"))
valueList.append(modelNode.variantProperty("height"));
if (!valueList.isEmpty())
nodeInstanceServer()->changePropertyValues(createChangeValueCommand(valueList));
if (!bindingList.isEmpty())
nodeInstanceServer()->changePropertyBindings(createChangeBindingCommand(bindingList));
}
示例5: detectVerticalCycle
bool detectVerticalCycle(const ModelNode &node, QList<ModelNode> knownNodeList)
{
if (!node.isValid())
return false;
if (knownNodeList.contains(node))
return true;
knownNodeList.append(node);
static QStringList validAnchorLines(QStringList() << "top" << "bottom" << "verticalCenter" << "baseline");
static QStringList anchorNames(QStringList() << "anchors.top" << "anchors.bottom" << "anchors.verticalCenter" << "anchors.baseline");
foreach (const QString &anchorName, anchorNames) {
if (node.hasBindingProperty(anchorName)) {
AbstractProperty targetProperty = node.bindingProperty(anchorName).resolveToProperty();
if (targetProperty.isValid()) {
if (!validAnchorLines.contains(targetProperty.name()))
return true;
if (detectVerticalCycle(targetProperty.parentModelNode(), knownNodeList))
return true;
}
}
}
static QStringList anchorShortcutNames(QStringList() << "anchors.fill" << "anchors.centerIn");
foreach (const QString &anchorName, anchorShortcutNames) {
if (node.hasBindingProperty(anchorName)) {
ModelNode targetNode = node.bindingProperty(anchorName).resolveToModelNode();
if (targetNode.isValid() && detectVerticalCycle(targetNode, knownNodeList))
return true;
}
}
return false;
}
示例6: bindingPropertyForRow
BindingProperty DynamicPropertiesModel::bindingPropertyForRow(int rowNumber) const
{
const int internalId = data(index(rowNumber, TargetModelNodeRow), Qt::UserRole + 1).toInt();
const QString targetPropertyName = data(index(rowNumber, TargetModelNodeRow), Qt::UserRole + 2).toString();
ModelNode modelNode = connectionView()->modelNodeForInternalId(internalId);
if (modelNode.isValid())
return modelNode.bindingProperty(targetPropertyName.toLatin1());
return BindingProperty();
}
示例7: detectHorizontalCycle
bool detectHorizontalCycle(const ModelNode &node, QList<ModelNode> knownNodeList)
{
if (knownNodeList.contains(node))
return true;
knownNodeList.append(node);
static PropertyNameList validAnchorLines(PropertyNameList() << "right" << "left" << "horizontalCenter");
static PropertyNameList anchorNames(PropertyNameList() << "anchors.right" << "anchors.left" << "anchors.horizontalCenter");
foreach (const PropertyName &anchorName, anchorNames) {
if (node.hasBindingProperty(anchorName)) {
AbstractProperty targetProperty = node.bindingProperty(anchorName).resolveToProperty();
if (targetProperty.isValid()) {
if (!validAnchorLines.contains(targetProperty.name()))
return true;
if (detectHorizontalCycle(targetProperty.parentModelNode(), knownNodeList))
return true;
}
}
}
static PropertyNameList anchorShortcutNames(PropertyNameList() << "anchors.fill" << "anchors.centerIn");
foreach (const PropertyName &anchorName, anchorShortcutNames) {
if (node.hasBindingProperty(anchorName)) {
ModelNode targetNode = node.bindingProperty(anchorName).resolveToModelNode();
if (targetNode.isValid() && detectHorizontalCycle(targetNode, knownNodeList))
return true;
}
}
return false;
}
示例8: data
QVariant StatesEditorModel::data(const QModelIndex &index, int role) const
{
if (index.parent().isValid() || index.column() != 0 || m_statesEditorView.isNull() || !m_statesEditorView->hasModelNodeForInternalId(index.internalId()))
return QVariant();
ModelNode stateNode;
if (index.internalId() > 0)
stateNode = m_statesEditorView->modelNodeForInternalId(index.internalId());
switch (role) {
case StateNameRole: {
if (index.row() == 0) {
return QString(tr("base state", "Implicit default state"));
} else {
if (stateNode.hasVariantProperty("name"))
return stateNode.variantProperty("name").value();
else
return QVariant();
}
}
case StateImageSourceRole: {
static int randomNumber = 0;
randomNumber++;
if (index.row() == 0)
return QString("image://qmldesigner_stateseditor/baseState-%1").arg(randomNumber);
else
return QString("image://qmldesigner_stateseditor/%1-%2").arg(index.internalId()).arg(randomNumber);
}
case InternalNodeId: return index.internalId();
case HasWhenCondition: return stateNode.isValid() && stateNode.hasProperty("when");
case WhenConditionString: {
if (stateNode.isValid() && stateNode.hasBindingProperty("when"))
return stateNode.bindingProperty("when").expression();
else
return QString();
}
}
return QVariant();
}
示例9: removeAliasExports
static void removeAliasExports(const QmlObjectNode &node)
{
PropertyName propertyName = node.id().toUtf8();
ModelNode rootNode = node.view()->rootModelNode();
bool hasAliasExport = !propertyName.isEmpty()
&& rootNode.isValid()
&& rootNode.hasBindingProperty(propertyName)
&& rootNode.bindingProperty(propertyName).isAliasExport();
if (hasAliasExport)
rootNode.removeProperty(propertyName);
foreach (const ModelNode &childNode, node.modelNode().directSubModelNodes()) {
removeAliasExports(childNode);
}
}
示例10: accept
void BehaviorDialog::accept()
{
QDialog::accept();
if (m_modelNode.hasProperty(m_propertyName))
m_modelNode.removeProperty(m_propertyName);
if (m_ui->comboBox->currentIndex() == 0) {
RewriterTransaction transaction(m_modelNode.view()->beginRewriterTransaction());
ModelNode Behavior = m_modelNode.view()->createModelNode("Qt/Behavior", 4, 7);
m_modelNode.nodeProperty(m_propertyName).reparentHere(Behavior);
ModelNode animation = m_modelNode.view()->createModelNode("Qt/NumberAnimation", 4, 7);
animation.variantProperty("duration") = m_ui->duration->value();
animation.variantProperty("easing") = m_ui->curve->currentText();
Behavior.nodeProperty("animation").reparentHere(animation);
} else {
RewriterTransaction transaction(m_modelNode.view()->beginRewriterTransaction());
ModelNode springFollow = m_modelNode.view()->createModelNode("Qt/SpringFollow", 4, 7);
m_modelNode.nodeProperty(m_propertyName).reparentHere(springFollow);
springFollow.variantProperty("velocity") = m_ui->velocity->value();
springFollow.variantProperty("spring") = m_ui->spring->value();
springFollow.variantProperty("damping") = m_ui->damping->value();
springFollow.bindingProperty("source") = m_ui->source->text();
}
}
示例11: auxiliaryDataChanged
void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data)
{
if ((node.isRootNode() && (name == "width" || name == "height")) || name.endsWith(PropertyName("@NodeInstance"))) {
if (hasInstanceForModelNode(node)) {
NodeInstance instance = instanceForModelNode(node);
QVariant value = data;
if (value.isValid()) {
PropertyValueContainer container(instance.instanceId(), name, value, TypeName());
ChangeAuxiliaryCommand changeAuxiliaryCommand(QVector<PropertyValueContainer>() << container);
nodeInstanceServer()->changeAuxiliaryValues(changeAuxiliaryCommand);
} else {
if (node.hasVariantProperty(name)) {
PropertyValueContainer container(instance.instanceId(), name, node.variantProperty(name).value(), TypeName());
ChangeValuesCommand changeValueCommand(QVector<PropertyValueContainer>() << container);
nodeInstanceServer()->changePropertyValues(changeValueCommand);
} else if (node.hasBindingProperty(name)) {
PropertyBindingContainer container(instance.instanceId(), name, node.bindingProperty(name).expression(), TypeName());
ChangeBindingsCommand changeValueCommand(QVector<PropertyBindingContainer>() << container);
nodeInstanceServer()->changePropertyBindings(changeValueCommand);
}
}
}
}
}
示例12: syncBindingProperties
static void syncBindingProperties(ModelNode &outputNode, const ModelNode &inputNode, const QHash<QString, QString> &idRenamingHash)
{
foreach (const BindingProperty &bindingProperty, inputNode.bindingProperties()) {
outputNode.bindingProperty(bindingProperty.name()).setExpression(fixExpression(bindingProperty.expression(), idRenamingHash));
}
}