本文整理汇总了C++中ModelNode::properties方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelNode::properties方法的具体用法?C++ ModelNode::properties怎么用?C++ ModelNode::properties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelNode
的用法示例。
在下文中一共展示了ModelNode::properties方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itemNode
static inline QHash<PropertyName, QVariant> getProperties(const ModelNode &node)
{
QHash<PropertyName, QVariant> propertyHash;
if (QmlObjectNode::isValidQmlObjectNode(node)) {
foreach (const AbstractProperty &abstractProperty, node.properties()) {
if (abstractProperty.isVariantProperty()
|| (abstractProperty.isBindingProperty()
&& !abstractProperty.name().contains("anchors.")))
propertyHash.insert(abstractProperty.name(), QmlObjectNode(node).instanceValue(abstractProperty.name()));
}
if (QmlItemNode::isValidQmlItemNode(node)) {
QmlItemNode itemNode(node);
propertyHash.insert("width", itemNode.instanceValue("width"));
propertyHash.insert("height", itemNode.instanceValue("height"));
propertyHash.remove("x");
propertyHash.remove("y");
propertyHash.remove("rotation");
propertyHash.remove("opacity");
}
}
return propertyHash;
}
示例2: compareTree
// TODO: this need to e updated for states
static bool compareTree(const ModelNode &node1, const ModelNode &node2)
{
if (!node1.isValid() || !node2.isValid()) {
return false;
}
if (node1.type() != node2.type()) {
return false;
}
// Compare properties
{
const QList<AbstractProperty> propList1 = node1.properties();
const QList<AbstractProperty> propList2 = node2.properties();
QList<AbstractProperty>::const_iterator iter1 = propList1.constBegin();
QList<AbstractProperty>::const_iterator iter2 = propList2.constBegin();
for (;
iter1 != propList1.constEnd() && iter2 != propList2.constEnd();
iter1++, iter2++) {
if (!compareProperty(*iter1, *iter2))
return false;
}
if (iter1 != propList1.constEnd() || iter2 != propList2.constEnd())
return false;
}
// Compare list of children
{
const QList<ModelNode> childList1 = node1.allDirectSubModelNodes();
const QList<ModelNode> childList2 = node2.allDirectSubModelNodes();
QList<ModelNode>::const_iterator iter1;
QList<ModelNode>::const_iterator iter2;
for (iter1 = childList1.constBegin(), iter2 = childList2.constBegin();
iter1 != childList1.constEnd() && iter2 != childList2.constEnd();
iter1++, iter2++) {
if (!compareTree((*iter1), (*iter2)))
return false;
}
if (iter1 != childList1.constEnd() || iter2 != childList2.constEnd())
return false;
}
return true;
}
示例3: selectThrough
static void selectThrough(ModelNode node, QWidget* propWidget = 0)
{
QVERIFY(node.isValid());
int numberOfProperties = node.propertyNames().count();
QList<AbstractProperty> properties = node.properties();
node.view()->clearSelectedModelNodes();
node.view()->selectModelNode(node);
QString name = node.id();
qApp->processEvents();
QTest::qSleep(100);
qApp->processEvents();
QTest::qSleep(100);
qApp->processEvents();
inspectPropertyEditor(node, propWidget);
//selecting should not effect any properties at all!
QCOMPARE(node.propertyNames().count(), numberOfProperties);
foreach (const AbstractProperty &property, properties)
if (property.isVariantProperty()) {
QCOMPARE(property.toVariantProperty().value(), node.variantProperty(property.name()).value());
}
QList<ModelNode> childNodes = node.allDirectSubModelNodes();
foreach (const ModelNode &childNode, childNodes)
selectThrough(childNode, propWidget);
}