本文整理汇总了C++中KisNodeSP::graphListener方法的典型用法代码示例。如果您正苦于以下问题:C++ KisNodeSP::graphListener方法的具体用法?C++ KisNodeSP::graphListener怎么用?C++ KisNodeSP::graphListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisNodeSP
的用法示例。
在下文中一共展示了KisNodeSP::graphListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: moveNode
bool KisNodeFacade::moveNode(KisNodeSP node, KisNodeSP parent, quint32 newIndex)
{
dbgImage << "moveNode " << node << " " << parent << " " << newIndex;
int oldIndex = node->parent()->index(node);
if (node->graphListener())
node->graphListener()->aboutToMoveNode(node.data(), oldIndex, newIndex);
KisNodeSP aboveThis = parent->at(newIndex - 1);
if (aboveThis == node) return false;
if (node->parent()) {
if (!node->parent()->remove(node)) return false;
}
dbgImage << "moving node to " << newIndex;
bool success = addNode(node, parent, aboveThis);
if (node->graphListener())
node->graphListener()->nodeHasBeenMoved(node.data(), oldIndex, newIndex);
return success;
}