mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-04-10 17:49:12 +02:00
Added a method to reset (clear + recreate) all vertices.
This commit is contained in:
14
Mapper.cpp
14
Mapper.cpp
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user