Commit 70fa002c authored by roangel's avatar roangel
Browse files

fixed problem removing cf zones?

parent 9e7b2a02
......@@ -45,7 +45,7 @@ public:
void removeTable();
public slots:
void removeCrazyFlyZone(int index);
void removeCrazyFlyZone(int cf_zone_index);
void setSelectedCrazyFlyZone(int index);
void changeModeTo(int next_mode);
......
......@@ -186,8 +186,8 @@ void MainGUIWindow::_init()
void MainGUIWindow::doTabClosed(int tab_index)
{
QString name = ui->tabWidget->tabText(tab_index);
int cf_index = cf_linker->getCFZoneIndexFromName(name);
scene->removeCrazyFlyZone(cf_index);
int cf_zone_index = cf_linker->getCFZoneIndexFromName(name);
scene->removeCrazyFlyZone(cf_zone_index);
}
void MainGUIWindow::setTabIndex(int index)
......
......@@ -321,13 +321,19 @@ QRectF myGraphicsScene::getRectFCrazyFlyZone(int index)
return rect;
}
void myGraphicsScene::removeCrazyFlyZone(int index)
void myGraphicsScene::removeCrazyFlyZone(int cf_zone_index)
{
int n = crazyfly_zones[index]->getIndex();
this->removeItem(crazyfly_zones[index]);
crazyfly_zones.erase(crazyfly_zones.begin() + index);
qDebug("removed CFzone %d", index);
emit numCrazyFlyZonesChanged(n); // for tab managing
for(int i = 0; i < crazyfly_zones.size(); i++)
{
if(crazyfly_zones[i]->getIndex() == cf_zone_index)
{
this->removeItem(crazyfly_zones[i]);
crazyfly_zones.erase(crazyfly_zones.begin() + i);
qDebug("removed CFzone %d", cf_zone_index);
emit numCrazyFlyZonesChanged(cf_zone_index); // for tab managing
break;
}
}
}
void myGraphicsScene::removeTable()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment