本文整理汇总了C++中KisNodeSP::firstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ KisNodeSP::firstChild方法的具体用法?C++ KisNodeSP::firstChild怎么用?C++ KisNodeSP::firstChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisNodeSP
的用法示例。
在下文中一共展示了KisNodeSP::firstChild方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testObligeSingleChildImpl
void testObligeSingleChildImpl(bool transpDefaultPixel)
{
QString id = !transpDefaultPixel ?
"single_layer_no_channel_flags_nontransp_def_pixel.kra" :
"single_layer_no_channel_flags_transp_def_pixel.kra";
QString fileName = TestUtil::fetchDataFileLazy(id);
KisDocument *doc = KisPart::instance()->createDocument();
doc->loadNativeFormat(fileName);
KisImageWSP image = doc->image();
QVERIFY(image);
QCOMPARE(image->nlayers(), 2);
KisNodeSP root = image->root();
KisNodeSP child = root->firstChild();
QVERIFY(child);
QCOMPARE(root->original(), root->projection());
if (transpDefaultPixel) {
QCOMPARE(root->original(), child->projection());
} else {
QVERIFY(root->original() != child->projection());
}
delete doc;
}
示例2: testCreation
void KisNodeFacadeTest::testCreation()
{
TestGraphListener graphListener;
KisNodeSP node = new TestNodeA();
QVERIFY(node->graphListener() == 0);
KisNodeFacade facade(node);
QVERIFY(facade.root() == node);
node->setGraphListener(&graphListener);
QVERIFY(node->graphListener() != 0);
// Test contract for initial state
QVERIFY(node->parent() == 0);
QVERIFY(node->firstChild() == 0);
QVERIFY(node->lastChild() == 0);
QVERIFY(node->prevSibling() == 0);
QVERIFY(node->nextSibling() == 0);
QVERIFY(node->childCount() == 0);
QVERIFY(node->at(0) == 0);
QVERIFY(node->at(UINT_MAX) == 0);
QVERIFY(node->index(0) == -1);
}
示例3: findFirstLayer
KisNodeSP KisDummiesFacadeBase::findFirstLayer(KisNodeSP root)
{
KisNodeSP child = root->firstChild();
while(child && !child->inherits("KisLayer")) {
child = child->nextSibling();
}
return child;
}
示例4: slotNodeAdded
void KisDummiesFacadeBase::slotNodeAdded(KisNodeSP node)
{
emit sigContinueAddNode(node, node->parent(), node->prevSibling());
KisNodeSP childNode = node->firstChild();
while (childNode) {
slotNodeAdded(childNode);
childNode = childNode->nextSibling();
}
}
示例5: checkHomogenity
bool checkHomogenity(KisNodeSP root)
{
bool res = true;
KisNodeSP child = root->firstChild();
while (child) {
if (child->childCount() > 0) {
res= false;
break;
}
child = child->nextSibling();
}
return res;
}
示例6: toBottom
bool KisNodeFacade::toBottom(KisNodeSP node)
{
if (!node) return false;
if (!node->parent()) return false;
KisNodeSP parent = node->parent();
if (node == parent->firstChild()) return true;
// Sets the parent of this node to 0
if (!parent->remove(node)) return false;
return parent->add(node, 0);
}
示例7: expandNodesRecursively
void expandNodesRecursively(KisNodeSP root, QPointer<KisNodeFilterProxyModel> filteringModel, KisNodeView *nodeView)
{
if (!root) return;
if (filteringModel.isNull()) return;
if (!nodeView) return;
nodeView->blockSignals(true);
KisNodeSP node = root->firstChild();
while (node) {
QModelIndex idx = filteringModel->indexFromNode(node);
if (idx.isValid()) {
if (node->collapsed()) {
nodeView->collapse(idx);
}
}
if (node->childCount() > 0) {
expandNodesRecursively(node, filteringModel, nodeView);
}
node = node->nextSibling();
}
nodeView->blockSignals(false);
}
示例8: expandNodesRecursively
void expandNodesRecursively(KisNodeSP root, QPointer<KisNodeModel> nodeModel, KoDocumentSectionView *sectionView)
{
if (!root) return;
if (nodeModel.isNull()) return;
if (!sectionView) return;
sectionView->blockSignals(true);
KisNodeSP node = root->firstChild();
while (node) {
QModelIndex idx = nodeModel->indexFromNode(node);
if (idx.isValid()) {
if (node->collapsed()) {
sectionView->collapse(idx);
}
}
if (node->childCount() > 0) {
expandNodesRecursively(node, nodeModel, sectionView);
}
node = node->nextSibling();
}
sectionView->blockSignals(false);
}
示例9: testOrdering
void KisNodeFacadeTest::testOrdering()
{
TestGraphListener graphListener;
KisNodeSP root = new TestNodeA();
root->setGraphListener(&graphListener);
KisNodeFacade facade(root);
KisNodeSP node1 = new TestNodeA();
KisNodeSP node2 = new TestNodeA();
KisNodeSP node3 = new TestNodeA();
KisNodeSP node4 = new TestNodeA();
KisNodeSP node5 = new TestNodeA();
/*
+---------+
| node 4 |
| node 2 |
| node 3|
| node 1 |
|root |
+---------+
*/
graphListener.resetBools();
QVERIFY(facade.addNode(node1, root, root->childCount()) == true);
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node1);
QVERIFY(root->childCount() == 1);
graphListener.resetBools();
QVERIFY(facade.addNode(node2, root, root->childCount()) == true);
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node2);
QVERIFY(root->childCount() == 2);
graphListener.resetBools();
QVERIFY(facade.addNode(node3, node1) == true);
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node2);
QVERIFY(root->childCount() == 2);
QVERIFY(node1->childCount() == 1);
graphListener.resetBools();
QVERIFY(facade.addNode(node4, root, root->lastChild()) == true);
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node4);
QVERIFY(root->childCount() == 3);
graphListener.resetBools();
QVERIFY(node1->parent() == root);
QVERIFY(node2->parent() == root);
QVERIFY(node3->parent() == node1);
QVERIFY(node4->parent() == root);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node4);
QVERIFY(root->at(0) == node1);
QVERIFY(root->at(1) == node2);
QVERIFY(root->at(2) == node4);
QVERIFY(node1->at(0) == node3);
QVERIFY(root->index(node1) == 0);
QVERIFY(root->index(node2) == 1);
QVERIFY(root->index(node4) == 2);
QVERIFY(node1->index(node3) == 0);
QVERIFY(node4->prevSibling() == node2);
QVERIFY(node2->prevSibling() == node1);
QVERIFY(node1->prevSibling() == 0);
QVERIFY(node3->prevSibling() == 0);
QVERIFY(node4->nextSibling() == 0);
QVERIFY(node2->nextSibling() == node4);
QVERIFY(node1->nextSibling() == node2);
QVERIFY(node3->nextSibling() == 0);
/*
node 4
node 2
node 3
node 1
//.........这里部分代码省略.........
示例10: testOrdering
void KisNodeTest::testOrdering()
{
TestUtil::TestGraphListener graphListener;
KisNodeSP root = new TestNodeA();
root->setGraphListener(&graphListener);
KisNodeSP node1 = new TestNodeA();
KisNodeSP node2 = new TestNodeA();
KisNodeSP node3 = new TestNodeA();
KisNodeSP node4 = new TestNodeA();
/*
+---------+
| node 4 |
| node 2 |
| node 3 |
| node 1 |
|root |
+---------+
*/
graphListener.resetBools();
QVERIFY(root->lastChild() == 0);
root->add(node1, root->lastChild());
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node1);
graphListener.resetBools();
QVERIFY(root->lastChild() == node1);
root->add(node2, root->lastChild());
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node2);
graphListener.resetBools();
QVERIFY(root->lastChild() == node2);
root->add(node3, node1);
QVERIFY(root->lastChild() == node2);
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node2);
graphListener.resetBools();
root->add(node4, root->lastChild());
QVERIFY(graphListener.beforeInsertRow == true);
QVERIFY(graphListener.afterInsertRow == true);
QVERIFY(graphListener.beforeRemoveRow == false);
QVERIFY(graphListener.afterRemoveRow == false);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node4);
graphListener.resetBools();
QVERIFY(root->childCount() == 4);
QVERIFY(node1->parent() == root);
QVERIFY(node2->parent() == root);
QVERIFY(node3->parent() == root);
QVERIFY(node4->parent() == root);
QVERIFY(root->firstChild() == node1);
QVERIFY(root->lastChild() == node4);
QVERIFY(root->at(0) == node1);
QVERIFY(root->at(1) == node3);
QVERIFY(root->at(2) == node2);
QVERIFY(root->at(3) == node4);
QVERIFY(root->index(node1) == 0);
QVERIFY(root->index(node3) == 1);
QVERIFY(root->index(node2) == 2);
QVERIFY(root->index(node4) == 3);
QVERIFY(node4->prevSibling() == node2);
QVERIFY(node3->prevSibling() == node1);
QVERIFY(node2->prevSibling() == node3);
QVERIFY(node1->prevSibling() == 0);
QVERIFY(node4->nextSibling() == 0);
QVERIFY(node3->nextSibling() == node2);
QVERIFY(node2->nextSibling() == node4);
QVERIFY(node1->nextSibling() == node3);
/*
+---------+
| node 3 |
| node 4 |
| node 2 |
| node 1 |
|root |
+---------+
//.........这里部分代码省略.........