Exemple #1
0
void MainWindow::addButtons()
{
    URDFparser* parser = URDFparser::getInstance();
    RobotModel rm = parser->rm;
    map<QString, Link> linksMap = rm.getLinks();
    map<QString, Joint> jointsMap = rm.getJoints();
    vector<Joint> joints = rm.sortJoints(jointsMap);
    cb = new QComboBox(ui->frame);
    QStringList* sl = new QStringList();
    button = new QPushButton("Test", ui->frame);
    button->show();

    for(uint i=0; i<joints.size();i++)
    {
        if(linksMap[joints.at(i).getParent().getLink()].getVisual().size()>0)
        {
            if(!sl->contains(joints.at(i).getParent().getLink()))
                sl->append(joints.at(i).getParent().getLink());
        }
        if(linksMap[joints.at(i).getChild().getLink()].getVisual().size()>0)
        {
            if(!sl->contains(joints.at(i).getChild().getLink()))
             sl->append(joints.at(i).getChild().getLink());
        }

    }
    cb->addItems(*sl);
    cb->setFixedWidth(150);
    button->setFixedWidth(40);
    connect(button, SIGNAL(released()), this, SLOT(testButtonClicked()));
    ui->formLayout->addRow(cb, button);
}
void TestWindow::on_beginTest_clicked()
{
    emit testButtonClicked();
    qDebug()<<"test button clicked!";
}