本文整理汇总了C++中KisNodeSP::childNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ KisNodeSP::childNodes方法的具体用法?C++ KisNodeSP::childNodes怎么用?C++ KisNodeSP::childNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisNodeSP
的用法示例。
在下文中一共展示了KisNodeSP::childNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deepChildCount
int deepChildCount(KisNodeSP layer)
{
quint32 childCount = layer->childCount();
QList<KisNodeSP> children = layer->childNodes(layerClassNames(), KoProperties());
for(quint32 i = 0; i < childCount; ++i)
childCount += deepChildCount(children.at(i));
return childCount;
}
示例2: testChildNodes
void KisNodeTest::testChildNodes()
{
KisNodeSP root = new TestNodeA();
KisNodeSP a = new TestNodeA();
root->add(a, 0);
a->setVisible(true);
a->setUserLocked(true);
KisNodeSP b = new TestNodeB();
root->add(b, 0);
b->setVisible(false);
b->setUserLocked(true);
KisNodeSP c = new TestNodeC();
root->add(c, 0);
c->setVisible(false);
c->setVisible(false);
QList<KisNodeSP> allNodes = root->childNodes(QStringList(), KoProperties());
QCOMPARE((int) allNodes.count(), 3); // a, b, c
QStringList nodeTypes;
nodeTypes << "TestNodeA" << "TestNodeB";
QList<KisNodeSP> subSetOfNodeTypes = root->childNodes(nodeTypes, KoProperties());
QVERIFY(subSetOfNodeTypes.count() == 2); // a, b
nodeTypes.clear();
nodeTypes << "TestNodeB" << "TestNodeC";
KoProperties props;
props.setProperty("visibile", false);
props.setProperty("locked", true);
QList<KisNodeSP> subsetOfTypesAndProps = root->childNodes(nodeTypes, props);
QVERIFY(subsetOfTypesAndProps.count() == 1); // b
KoProperties props2;
props.setProperty("visibile", false);
QList<KisNodeSP> subSetOfProps = root->childNodes(QStringList(), props);
QVERIFY(subSetOfProps.count() == 2); // b, c
}