mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-22 13:49:58 +01:00
Minor change : Change behavior of shape creation in diagram editor, to be same has element editor
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3580 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -93,6 +93,15 @@ void QetShapeItem::setP2(QPointF P2) {
|
||||
setTransformOriginPoint(boundingRect().center());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetShapeItem::pointCount
|
||||
* @return the number of point in the polygon
|
||||
*/
|
||||
int QetShapeItem::pointsCount() const
|
||||
{
|
||||
return m_polygon.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetShapeItem::setNextPoint
|
||||
* Add a new point to the curent polygon
|
||||
@@ -104,6 +113,29 @@ void QetShapeItem::setNextPoint(QPointF P) {
|
||||
setTransformOriginPoint(boundingRect().center());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetShapeItem::removePoints
|
||||
* Number of point to remove on the polygon
|
||||
* If @number is superior to number of polygon points-2,
|
||||
* all points of polygon will be removed except the first two (minimum point for the polygon);
|
||||
*/
|
||||
void QetShapeItem::removePoints(int number)
|
||||
{
|
||||
if (pointsCount() == 2 || number < 1) return;
|
||||
if ((pointsCount()-2) < number)
|
||||
number = pointsCount() - 2;
|
||||
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
i++;
|
||||
prepareGeometryChange();
|
||||
m_polygon.pop_back();
|
||||
setTransformOriginPoint(boundingRect().center());
|
||||
|
||||
} while (i < number);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief QetShapeItem::boundingRect
|
||||
* @return the bounding rect of this item
|
||||
|
||||
Reference in New Issue
Block a user