当前位置: 首页>>代码示例>>C++>>正文


C++ KoSelection::firstSelectedShape方法代码示例

本文整理汇总了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);
    }
}
开发者ID:ChrisJong,项目名称:krita,代码行数:27,代码来源:KarbonCalligraphyTool.cpp

示例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);
}
开发者ID:foren197316,项目名称:calligra,代码行数:27,代码来源:RoundCornersPlugin.cpp

示例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()));
}
开发者ID:foren197316,项目名称:calligra,代码行数:26,代码来源:WhirlPinchPlugin.cpp

示例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() );
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例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 );
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例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()));
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:23,代码来源:RefinePathPlugin.cpp


注:本文中的KoSelection::firstSelectedShape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。