本文整理汇总了C++中KoSelection::setActiveLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ KoSelection::setActiveLayer方法的具体用法?C++ KoSelection::setActiveLayer怎么用?C++ KoSelection::setActiveLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoSelection
的用法示例。
在下文中一共展示了KoSelection::setActiveLayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q_ASSERT
bool KisNodeManager::Private::activateNodeImpl(KisNodeSP node)
{
Q_ASSERT(view);
Q_ASSERT(view->canvasBase());
Q_ASSERT(view->canvasBase()->globalShapeManager());
Q_ASSERT(imageView);
if (node && node == q->activeNode()) {
return false;
}
// Set the selection on the shape manager to the active layer
// and set call KoSelection::setActiveLayer( KoShapeLayer* layer )
// with the parent of the active layer.
KoSelection *selection = view->canvasBase()->globalShapeManager()->selection();
Q_ASSERT(selection);
selection->deselectAll();
if (!node) {
selection->setActiveLayer(0);
imageView->setCurrentNode(0);
maskManager.activateMask(0);
layerManager.activateLayer(0);
} else {
KoShape * shape = view->document()->shapeForNode(node);
Q_ASSERT(shape);
selection->select(shape);
KoShapeLayer * shapeLayer = dynamic_cast<KoShapeLayer*>(shape);
Q_ASSERT(shapeLayer);
// shapeLayer->setGeometryProtected(node->userLocked());
// shapeLayer->setVisible(node->visible());
selection->setActiveLayer(shapeLayer);
imageView->setCurrentNode(node);
if (KisLayerSP layer = dynamic_cast<KisLayer*>(node.data())) {
maskManager.activateMask(0);
layerManager.activateLayer(layer);
} else if (KisMaskSP mask = dynamic_cast<KisMask*>(node.data())) {
maskManager.activateMask(mask);
// XXX_NODE: for now, masks cannot be nested.
layerManager.activateLayer(static_cast<KisLayer*>(node->parent().data()));
}
}
return true;
}
示例2: updateActivePage
void KPrViewModeNotes::updateActivePage( KoPAPageBase *page )
{
if ( m_view->activePage() != page ) {
m_view->setActivePage( page );
}
KPrPage *prPage = dynamic_cast<KPrPage *>( page );
if ( !prPage ) return;
KPrNotes *notes = prPage->pageNotes();
notes->updatePageThumbnail();
KoShapeLayer* layer = dynamic_cast<KoShapeLayer*>( notes->childShapes().last() );
KoPageLayout &layout = notes->pageLayout();
QSize size(layout.width, layout.height);
m_view->horizontalRuler()->setRulerLength(layout.width);
m_view->verticalRuler()->setRulerLength(layout.height);
m_view->horizontalRuler()->setActiveRange(layout.left, layout.width - layout.right);
m_view->verticalRuler()->setActiveRange(layout.top, layout.height - layout.bottom);
m_view->zoomController()->setPageSize(size);
m_view->zoomController()->setDocumentSize(size);
m_canvas->update();
m_canvas->shapeManager()->setShapes( layer->childShapes() );
m_canvas->masterShapeManager()->setShapes(QList<KoShape*>());
KoSelection *selection = m_canvas->shapeManager()->selection();
selection->select(notes->textShape());
selection->setActiveLayer( layer );
QString tool = KoToolManager::instance()->preferredToolForSelection(selection->selectedShapes());
KoToolManager::instance()->switchToolRequested(tool);
}