本文整理汇总了C++中ModelNode::nodeProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::nodeProperty方法的具体用法?C++ ModelNode::nodeProperty怎么用?C++ ModelNode::nodeProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::nodeProperty方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleTabComponent
static void handleTabComponent(const ModelNode &modelNode)
{
if (modelNode.hasNodeProperty("component")
&& modelNode.nodeProperty("component").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource) {
designDocument()->changeToSubComponent(modelNode.nodeProperty("component").modelNode());
}
}
示例2: handleDelegate
static void handleDelegate(const ModelNode &modelNode)
{
if (modelNode.metaInfo().isView()
&& modelNode.hasNodeProperty("delegate")
&& modelNode.nodeProperty("delegate").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource)
designDocument()->changeToSubComponent(modelNode.nodeProperty("delegate").modelNode());
}
示例3: syncNodeProperties
static void syncNodeProperties(ModelNode &outputNode, const ModelNode &inputNode, const QHash<QString, QString> &idRenamingHash, AbstractView *view)
{
foreach (const NodeProperty &nodeProperty, inputNode.nodeProperties()) {
ModelNode newNode = createNodeFromNode(nodeProperty.modelNode(), idRenamingHash, view);
outputNode.nodeProperty(nodeProperty.name()).reparentHere(newNode);
}
}
示例4: setupGradient
void GradientLineQmlAdaptor::setupGradient()
{
if (!active())
return;
ModelNode modelNode = m_itemNode.modelNode();
QLinearGradient newGradient;
QVector<QGradientStop> stops;
if (!modelNode.isValid())
return;
if (modelNode.hasBindingProperty(gradientName()))
return;
if (modelNode.hasProperty(gradientName())) { //gradient exists
ModelNode gradientNode = modelNode.nodeProperty(gradientName()).modelNode();
QList<ModelNode> stopList = gradientNode.nodeListProperty("stops").toModelNodeList();
foreach (const ModelNode &stopNode, stopList) {
QmlObjectNode stopObjectNode = stopNode;
if (stopObjectNode.isValid()) {
qreal position = stopObjectNode.modelValue("position").toReal();
QColor color = stopObjectNode.modelValue("color").value<QColor>();
stops.append( QPair<qreal, QColor>(position, color));
}
}
示例5: openComponentSourcePropertyOfLoader
static void openComponentSourcePropertyOfLoader(const ModelNode &modelNode)
{
QmlDesignerPlugin::instance()->viewManager().nextFileIsCalledInternally();
QHash<PropertyName, QVariant> propertyHash;
getProperties(modelNode, propertyHash);
ModelNode componentModelNode;
if (modelNode.hasNodeProperty("sourceComponent")) {
componentModelNode = modelNode.nodeProperty("sourceComponent").modelNode();
} else if (modelNode.hasNodeListProperty("component")) {
/*
* The component property should be a NodeProperty, but currently is a NodeListProperty, because
* the default property is always implcitly a NodeListProperty. This is something that has to be fixed.
*/
componentModelNode = modelNode.nodeListProperty("component").toModelNodeList().first();
}
Core::EditorManager::openEditor(componentModelNode.metaInfo().componentFileName(), Core::Id(), Core::EditorManager::DoNotMakeVisible);
ModelNode rootModelNode = currentDesignDocument()->rewriterView()->rootModelNode();
applyProperties(rootModelNode, propertyHash);
}
示例6: 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;
}
示例7: hasDelegateWithFileComponent
static bool hasDelegateWithFileComponent(const ModelNode &node)
{
if (node.isValid()
&& node.metaInfo().isValid()
&& node.metaInfo().isView()
&& node.hasNodeProperty("delegate")
&& node.nodeProperty("delegate").modelNode().metaInfo().isFileComponent())
return true;
return false;
}
示例8: isInEditedPath
static bool isInEditedPath(const NodeAbstractProperty &propertyParent, const ModelNode &editingPathViewModelNode)
{
if (editingPathViewModelNode.isValid()) {
if (editingPathViewModelNode.hasNodeProperty("path")) {
ModelNode pathModelNode = editingPathViewModelNode.nodeProperty("path").modelNode();
if (pathModelNode.metaInfo().isSubclassOf("QtQuick.Path")) {
if (propertyParent.name() == "pathElements" && propertyParent.parentModelNode() == pathModelNode)
return true;
}
}
}
return false;
}
示例9: 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();
}
}
示例10: addNodeChild
static ModelNode addNodeChild(const ModelNode &parentNode, const QString &typeName, int major, int minor, const QString &parentProperty)
{
ModelNode newNode = parentNode.view()->createModelNode(typeName, major, minor);
parentNode.nodeProperty(parentProperty).reparentHere(newNode);
return newNode;
}
示例11: openFileComponentForDelegate
static void openFileComponentForDelegate(const ModelNode &modelNode)
{
openFileComponent(modelNode.nodeProperty("delegate").modelNode());
}