Commit d3d99396 authored by roangel's avatar roangel
Browse files

Now its working perfectly apparently. Problem was only that current changed function

parent 50417e15
......@@ -73,39 +73,39 @@ void MainGUIWindow::doNumCrazyFlyZonesChanged(int n)
// first check if size of tabs is greater than size of vector or viceversa. Have we removed or added a zone?
qDebug("tabWidgetCount : %d", ui->tabWidget->count());
// if(ui->tabWidget->count() > scene->crazyfly_zones.size())
// {
// // we removed one crazyfly_zone, n means index of the one we removed. Look for that index tab and remove it
// QString qstr = "CrazyFly ";
// qstr.append(QString::number(n+1));
// if(scene->crazyfly_zones.size() == 0)
// {
// ui->tabWidget->clear();
// }
// int found_index = getTabIndexFromName(qstr);
// if(found_index != -1)
// {
// ui->tabWidget->widget(found_index)->deleteLater();
// // ui->tabWidget->removeTab(found_index);
// }
// // now unlink it from table also:
// #ifdef CATKIN_MAKE
// if(cf_linker->isCFZoneLinked(n))
// {
// cf_linker->unlink_cf_zone(n);
// }
// #endif
// }
// else if(ui->tabWidget->count() < scene->crazyfly_zones.size())
// {
// // we added one crazyfly_zone, n means index of the new one. New tab will be labeld index + 1
// QString qstr = "CrazyFly ";
// qstr.append(QString::number(n+1));
// crazyFlyZoneTab* widget = new crazyFlyZoneTab(n);
// ui->tabWidget->insertTab(n, widget, qstr);
// connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int)));
// }
if(ui->tabWidget->count() > scene->crazyfly_zones.size())
{
// we removed one crazyfly_zone, n means index of the one we removed. Look for that index tab and remove it
QString qstr = "CrazyFly ";
qstr.append(QString::number(n+1));
if(scene->crazyfly_zones.size() == 0)
{
ui->tabWidget->clear();
}
int found_index = getTabIndexFromName(qstr);
if(found_index != -1)
{
ui->tabWidget->widget(found_index)->deleteLater();
// ui->tabWidget->removeTab(found_index);
}
// now unlink it from table also:
#ifdef CATKIN_MAKE
if(cf_linker->isCFZoneLinked(n))
{
cf_linker->unlink_cf_zone(n);
}
#endif
}
else if(ui->tabWidget->count() < scene->crazyfly_zones.size())
{
// we added one crazyfly_zone, n means index of the new one. New tab will be labeld index + 1
QString qstr = "CrazyFly ";
qstr.append(QString::number(n+1));
crazyFlyZoneTab* widget = new crazyFlyZoneTab(n);
ui->tabWidget->insertTab(n, widget, qstr);
connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int)));
}
// for(int index = 0; index < ui->tabWidget->count(); index++)
// {
......@@ -116,20 +116,20 @@ void MainGUIWindow::doNumCrazyFlyZonesChanged(int n)
// // unlink all?
// // cf_linker->clear_all_links();
ui->tabWidget->clear();
// ui->tabWidget->clear();
for(int i = 0; i < scene->crazyfly_zones.size(); i++)
{
ROS_INFO("inside for loop");
QString qstr = "CrazyFly ";
int CF_index = scene->crazyfly_zones[i]->getIndex();
qstr.append(QString::number(CF_index + 1));
crazyFlyZoneTab* widget = new crazyFlyZoneTab(i);
// ui->tabWidget->insertTab(i, widget, qstr);
ui->tabWidget->addTab(widget, qstr);
ROS_INFO("Added tab");
connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int)));
}
// for(int i = 0; i < scene->crazyfly_zones.size(); i++)
// {
// ROS_INFO("inside for loop");
// QString qstr = "CrazyFly ";
// int CF_index = scene->crazyfly_zones[i]->getIndex();
// qstr.append(QString::number(CF_index + 1));
// crazyFlyZoneTab* widget = new crazyFlyZoneTab(i);
// // ui->tabWidget->insertTab(i, widget, qstr);
// ui->tabWidget->addTab(widget, qstr);
// ROS_INFO("Added tab");
// connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int)));
// }
// for(int i = 0; i < n; i++)
......
2,CF1,123,0,0.66,0.11,-0.2,3.46,1.76,2
1,CF2,1234,1,0.78,-2.09,-0.2,3.38,-0.45,2
5,CF3,12346,2,3.94,-1.07,-0.2,5.33,0.81,2
2,CF1,1,0,0.52,0.41,-0.2,1.56,1.55,2
1,CF2,3,1,-1.15,-0.69,-0.2,0.94,0.46,2
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