Added a method to reset (clear + recreate) all vertices.

This commit is contained in:
Tats
2015-07-06 16:56:42 -06:00
parent b9177b9418
commit 52ebee732f
2 changed files with 17 additions and 0 deletions

View File

@@ -131,6 +131,20 @@ void ShapeGraphicsItem::paint(QPainter *painter,
// return QGraphicsItem::itemChange(change, value);
//}
void ShapeGraphicsItem::resetVertices() {
// Clear vertices.
QList<QGraphicsItem*> allChildren = children();
for (QList<QGraphicsItem*>::iterator it = allChildren.begin(); it!=allChildren.end(); ++it)
{
(*it)->setParentItem(0);
scene()->removeItem(*it);
delete (*it);
}
// Re-create them.
_createVertices();
}
void ShapeGraphicsItem::_createVertices()
{
// rect offset