Fixed: #1302 Fixed crash program.

--HG--
branch : gsoc2011-worldeditorqt
This commit is contained in:
dnk-88 2011-08-11 14:14:56 +03:00
parent f4d699c534
commit e39cc48a3a
3 changed files with 12 additions and 1 deletions

View file

@ -121,7 +121,7 @@ void removeGraphicsItems(const QModelIndex &primIndex, PrimitivesTreeModel *mode
{
QGraphicsItem *item = qvariant_cast<QGraphicsItem *>(node->data(Constants::GRAPHICS_DATA_QT4_2D));
if (item != 0)
delete item;
scene->removeWorldItem(item);
break;
}
}

View file

@ -80,6 +80,15 @@ QGraphicsItem *WorldEditorScene::addWorldItemZone(const QPolygonF &polygon)
return item;
}
void WorldEditorScene::removeWorldItem(QGraphicsItem *item)
{
updateSelectedItems(true);
m_selectedItems.clear();
m_editedSelectedItems = false;
m_firstSelection = false;
delete item;
}
void WorldEditorScene::setModeEdit(WorldEditorScene::ModeEdit mode)
{
if (mode == WorldEditorScene::SelectMode)

View file

@ -59,6 +59,8 @@ public:
QGraphicsItem *addWorldItemPath(const QPolygonF &polyline);
QGraphicsItem *addWorldItemZone(const QPolygonF &polygon);
void removeWorldItem(QGraphicsItem *item);
void setModeEdit(WorldEditorScene::ModeEdit mode);
WorldEditorScene::ModeEdit editMode() const;