本文整理汇总了C++中KoPathShape::insertPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ KoPathShape::insertPoint方法的具体用法?C++ KoPathShape::insertPoint怎么用?C++ KoPathShape::insertPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoPathShape
的用法示例。
在下文中一共展示了KoPathShape::insertPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redo
void KoPathPointInsertCommand::redo()
{
QUndoCommand::redo();
for (int i = m_pointDataList.size() - 1; i >= 0; --i) {
KoPathPointData pointData = m_pointDataList.at(i);
KoPathShape * pathShape = pointData.pathShape;
KoPathSegment segment = pathShape->segmentByIndex(pointData.pointIndex);
++pointData.pointIndex.second;
if (segment.first()->activeControlPoint2()) {
QPointF controlPoint2 = segment.first()->controlPoint2();
qSwap(controlPoint2, m_controlPoints[i].first);
segment.first()->setControlPoint2(controlPoint2);
}
if (segment.second()->activeControlPoint1()) {
QPointF controlPoint1 = segment.second()->controlPoint1();
qSwap(controlPoint1, m_controlPoints[i].second);
segment.second()->setControlPoint1(controlPoint1);
}
pathShape->insertPoint(m_points.at(i), pointData.pointIndex);
pathShape->update();
}
m_deletePoints = false;
}
示例2: redo
void KoPathBreakAtPointCommand::redo()
{
KUndo2Command::redo();
KoPathPointData last(0, KoPathPointIndex(-1, -1));
// offset, needed when path was opened
int offset = 0;
for (int i = m_pointDataList.size() - 1; i >= 0; --i) {
const KoPathPointData & pd = m_pointDataList.at(i);
KoPathShape * pathShape = pd.pathShape;
KoPathPointIndex pointIndex = pd.pointIndex;
if (last.pathShape != pathShape || last.pointIndex.first != pointIndex.first) {
offset = 0;
}
pointIndex.second = pointIndex.second + offset + 1;
pathShape->insertPoint(m_points[i], pointIndex);
if (m_closedIndex.at(i).first != -1) {
m_closedIndex[i] = pathShape->openSubpath(m_closedIndex.at(i));
offset = m_closedIndex.at(i).second;
} else {
KoPathPointIndex breakIndex = pd.pointIndex;
breakIndex.second += offset;
pathShape->breakAfter(breakIndex);
m_closedIndex[i].second = offset;
}
if (last.pathShape != pathShape) {
if (last.pathShape) {
last.pathShape->update();
}
last = pd;
}
}
if (last.pathShape) {
last.pathShape->update();
}
m_deletePoints = false;
}