Adds the new item to the selected group when created

This commit is contained in:
Maxime Gimeno 2015-12-30 15:59:51 +01:00
parent e4f6cb9f4e
commit 019db00106
1 changed files with 11 additions and 0 deletions

View File

@ -80,6 +80,17 @@ Scene::addItem(CGAL::Three::Scene_item* item)
Q_EMIT updated();
Item_id id = m_entries.size() - 1;
Q_EMIT newItem(id);
//if group selected, add item to it
if(mainSelectionIndex() >=0)
{
CGAL::Three::Scene_group_item* selected_group =
qobject_cast<CGAL::Three::Scene_group_item*>(m_entries.at(mainSelectionIndex()));
if(selected_group)
{
selected_group->addChild(item);
group_added();
}
}
return id;
}