本文整理汇总了C++中ModelNode::nodeListProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::nodeListProperty方法的具体用法?C++ ModelNode::nodeListProperty怎么用?C++ ModelNode::nodeListProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::nodeListProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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));
}
}
示例3: syncNodeListProperties
static void syncNodeListProperties(ModelNode &outputNode, const ModelNode &inputNode, const QHash<QString, QString> &idRenamingHash, AbstractView *view)
{
foreach (const NodeListProperty &nodeListProperty, inputNode.nodeListProperties()) {
foreach (const ModelNode &node, nodeListProperty.toModelNodeList()) {
ModelNode newNode = createNodeFromNode(node, idRenamingHash, view);
outputNode.nodeListProperty(nodeListProperty.name()).reparentHere(newNode);
}
}
}
示例4: removeNode
void TestPropertyEditor::removeNode()
{
std::auto_ptr<QWidget> widget(new QWidget());
QScopedPointer<Model> model(Model::create("import Qt 4.6\n Item {}"));
QVERIFY(model.data());
QScopedPointer<TestView> view(new TestView);
QVERIFY(view.data());
model->attachView(view.data());
setupPropertyEditor(widget.get(), model.data());
QCOMPARE(view->rootModelNode().allDirectSubModelNodes().count(), 0);
selectThrough(view->rootModelNode());
ModelNode childNode = view->createModelNode("Qt/Rectangle", 4, 6);
view->rootModelNode().nodeListProperty("data").reparentHere(childNode);
QVERIFY(childNode.isValid());
QCOMPARE(view->rootModelNode().allDirectSubModelNodes().count(), 1);
QVERIFY(view->rootModelNode().allDirectSubModelNodes().contains(childNode));
QVERIFY(childNode.parentProperty().parentModelNode() == view->rootModelNode());
selectThrough(childNode);
ModelNode subChildNode = view->createModelNode("Qt/Rectangle", 4, 6);
childNode.nodeListProperty("data").reparentHere(subChildNode);
QVERIFY(subChildNode.isValid());
QCOMPARE(childNode.allDirectSubModelNodes().count(), 1);
QVERIFY(childNode.allDirectSubModelNodes().contains(subChildNode));
QVERIFY(subChildNode.parentProperty().parentModelNode() == childNode);
selectThrough(subChildNode);
childNode.destroy();
QCOMPARE(view->rootModelNode().allDirectSubModelNodes().count(), 0);
QVERIFY(!view->rootModelNode().allDirectSubModelNodes().contains(childNode));
QVERIFY(!childNode.isValid());
QVERIFY(!subChildNode.isValid());
}
示例5: addNodeListChild
static ModelNode addNodeListChild(const ModelNode &parentNode, const QString &typeName, int major, int minor, const QString &parentProperty)
{
ModelNode newNode = parentNode.view()->createModelNode(typeName, major, minor);
parentNode.nodeListProperty(parentProperty).reparentHere(newNode);
return newNode;
}