本文整理汇总了C++中KisImageSP::moveNode方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageSP::moveNode方法的具体用法?C++ KisImageSP::moveNode怎么用?C++ KisImageSP::moveNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageSP
的用法示例。
在下文中一共展示了KisImageSP::moveNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testMoveLayer
void KisLayerTest::testMoveLayer()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->colorSpace("RGBA", 0);
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
KisLayerSP node1 = new TestLayer(image, "layer1", OPACITY_OPAQUE);
KisLayerSP node2 = new TestLayer(image, "layer2", OPACITY_OPAQUE);
KisLayerSP node3 = new TestLayer(image, "layer3", OPACITY_OPAQUE);
node1->setName("node1");
node2->setName("node2");
node3->setName("node3");
QVERIFY(image->addNode(node1));
QVERIFY(image->addNode(node2));
QVERIFY(image->addNode(node3));
QVERIFY(image->root()->at(0) == node1.data());
QVERIFY(image->root()->at(1) == node2.data());
QVERIFY(image->root()->at(2) == node3.data());
QVERIFY(image->moveNode(node3, image->rootLayer(), node1));
QVERIFY(image->root()->at(0) == node1.data());
QVERIFY(image->root()->at(1) == node3.data());
QVERIFY(image->root()->at(2) == node2.data());
}
示例2: redo
void KisImageLayerMoveCommand::redo()
{
KisImageSP image = m_image.toStrongRef();
if (!image) {
return;
}
if (m_useIndex) {
image->moveNode(m_layer, m_newParent, m_index);
} else {
image->moveNode(m_layer, m_newParent, m_newAbove);
}
if (m_doUpdates) {
image->refreshGraphAsync(m_prevParent);
if (m_newParent != m_prevParent) {
m_layer->setDirty(image->bounds());
}
}
}
示例3: testOrdering
void KisLayerTest::testOrdering()
{
const KoColorSpace * colorSpace = KoColorSpaceRegistry::instance()->colorSpace("RGBA", 0);
KisImageSP image = new KisImage(0, 512, 512, colorSpace, "layer test");
KisLayerSP layer1 = new TestLayer(image, "layer1", OPACITY_OPAQUE);
KisLayerSP layer2 = new TestLayer(image, "layer2", OPACITY_OPAQUE);
KisLayerSP layer3 = new TestLayer(image, "layer3", OPACITY_OPAQUE);
QVERIFY(layer1->name() == "layer1");
QVERIFY(layer2->name() == "layer2");
QVERIFY(layer3->name() == "layer3");
/*
+---------+
| layer 2 |
| layer 3 |
| layer 1 |
|root |
+---------+
*/
QVERIFY(image->addNode(layer1, image->rootLayer()));
QVERIFY(image->addNode(layer2, image->rootLayer()));
QVERIFY(image->addNode(layer3, image->rootLayer(), layer1));
QCOMPARE((int) image->nlayers(), 4);
QVERIFY(layer1->parent() == image->root());
QVERIFY(layer2->parent() == image->root());
QVERIFY(layer3->parent() == image->root());
QVERIFY(image->rootLayer()->firstChild() == layer1.data());
QVERIFY(image->rootLayer()->lastChild() == layer2.data());
QVERIFY(image->rootLayer()->at(0) == layer1.data());
QVERIFY(image->rootLayer()->at(1) == layer3.data());
QVERIFY(image->rootLayer()->at(2) == layer2.data());
QVERIFY(image->rootLayer()->index(layer1) == 0);
QVERIFY(image->rootLayer()->index(layer3) == 1);
QVERIFY(image->rootLayer()->index(layer2) == 2);
QVERIFY(layer3->prevSibling() == layer1.data());
QVERIFY(layer2->prevSibling() == layer3.data());
QVERIFY(layer1->prevSibling() == 0);
QVERIFY(layer3->nextSibling() == layer2.data());
QVERIFY(layer2->nextSibling() == 0);
QVERIFY(layer1->nextSibling() == layer3.data());
/*
+---------+
| layer 3 |
| layer 2 |
| layer 1 |
|root |
+---------+
*/
QVERIFY(image->moveNode(layer2, image->rootLayer(), layer1));
QVERIFY(image->rootLayer()->at(0) == layer1.data());
QVERIFY(image->rootLayer()->at(1) == layer2.data());
QVERIFY(image->rootLayer()->at(2) == layer3.data());
QVERIFY(image->rootLayer()->firstChild() == layer1.data());
QVERIFY(image->rootLayer()->lastChild() == layer3.data());
QVERIFY(image->rootLayer()->index(layer1) == 0);
QVERIFY(image->rootLayer()->index(layer2) == 1);
QVERIFY(image->rootLayer()->index(layer3) == 2);
QVERIFY(layer3->prevSibling() == layer2.data());
QVERIFY(layer2->prevSibling() == layer1.data());
QVERIFY(layer1->prevSibling() == 0);
QVERIFY(layer3->nextSibling() == 0);
QVERIFY(layer2->nextSibling() == layer3.data());
QVERIFY(layer1->nextSibling() == layer2.data());
}