本文整理汇总了C++中KoSelection::firstSelectedShape方法的典型用法代码示例。如果您正苦于以下问题:C++ KoSelection::firstSelectedShape方法的具体用法?C++ KoSelection::firstSelectedShape怎么用?C++ KoSelection::firstSelectedShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoSelection
的用法示例。
在下文中一共展示了KoSelection::firstSelectedShape方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateSelectedPath
void KarbonCalligraphyTool::updateSelectedPath()
{
KoPathShape *oldSelectedPath = m_selectedPath; // save old value
KoSelection *selection = canvas()->shapeManager()->selection();
// null pointer if it the selection isn't a KoPathShape
// or if the selection is empty
m_selectedPath =
dynamic_cast<KoPathShape *>(selection->firstSelectedShape());
// or if it's a KoPathShape but with no or more than one subpaths
if (m_selectedPath && m_selectedPath->subpathCount() != 1) {
m_selectedPath = 0;
}
// or if there ora none or more than 1 shapes selected
if (selection->count() != 1) {
m_selectedPath = 0;
}
// emit signal it there wasn't a selected path and now there is
// or the other way around
if ((m_selectedPath != 0) != (oldSelectedPath != 0)) {
emit pathSelectedChanged(m_selectedPath != 0);
}
}
示例2: slotRoundCorners
void RoundCornersPlugin::slotRoundCorners()
{
KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController();
KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
KoShape * shape = selection->firstSelectedShape();
if (! shape)
return;
// check if we have a path based shape
KoPathShape * path = dynamic_cast<KoPathShape*>(shape);
if (! path)
return;
m_roundCornersDlg->setUnit(canvasController->canvas()->unit());
if (QDialog::Rejected == m_roundCornersDlg->exec())
return;
KUndo2Command * cmd = new KUndo2Command(kundo2_i18n("Round Corners"));
// convert to path before if we have a parametric shape
KoParameterShape * ps = dynamic_cast<KoParameterShape*>(shape);
if (ps && ps->isParametricShape())
new KoParameterToPathCommand(ps, cmd);
new RoundCornersCommand(path, m_roundCornersDlg->radius(), cmd);
canvasController->canvas()->addCommand(cmd);
}
示例3: slotWhirlPinch
void WhirlPinchPlugin::slotWhirlPinch()
{
KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController();
KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
KoShape * shape = selection->firstSelectedShape();
if (! shape)
return;
// check if we have a path based shape
KoPathShape * path = dynamic_cast<KoPathShape*>(shape);
if (! path)
return;
// check if it is no parametric shape
KoParameterShape * ps = dynamic_cast<KoParameterShape*>(shape);
if (ps && ps->isParametricShape())
return;
m_whirlPinchDlg->setUnit(canvasController->canvas()->unit());
if (QDialog::Rejected == m_whirlPinchDlg->exec())
return;
canvasController->canvas()->addCommand(
new KarbonWhirlPinchCommand(path, m_whirlPinchDlg->angle(), m_whirlPinchDlg->pinch(), m_whirlPinchDlg->radius()));
}
示例4: selectionChanged
void StrokeDocker::selectionChanged()
{
KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController();
KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
KoShape * shape = selection->firstSelectedShape();
if( shape )
setStroke( shape->border() );
}
示例5: applyChanges
void StrokeDocker::applyChanges()
{
KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController();
KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
canvasController->canvas()->resourceProvider()->setActiveBorder( d->border );
if( ! selection || ! selection->count() )
return;
KoLineBorder * newBorder = new KoLineBorder(d->border);
KoLineBorder * oldBorder = dynamic_cast<KoLineBorder*>( selection->firstSelectedShape()->border() );
if( oldBorder )
{
newBorder->setColor( oldBorder->color() );
newBorder->setLineBrush( oldBorder->lineBrush() );
}
KoShapeBorderCommand *cmd = new KoShapeBorderCommand( selection->selectedShapes(), newBorder );
canvasController->canvas()->addCommand( cmd );
}
示例6: slotRefinePath
void RefinePathPlugin::slotRefinePath()
{
KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController();
KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
KoShape * shape = selection->firstSelectedShape();
if (! shape)
return;
// check if we have a path based shape
KoPathShape * path = dynamic_cast<KoPathShape*>(shape);
if (! path)
return;
// check if it is no parametric shape
KoParameterShape * ps = dynamic_cast<KoParameterShape*>(shape);
if (ps && ps->isParametricShape())
return;
if (QDialog::Rejected == m_RefinePathDlg->exec())
return;
canvasController->canvas()->addCommand(new KarbonPathRefineCommand(path, m_RefinePathDlg->knots()));
}