37 #include <QVBoxLayout> 38 #include <QHBoxLayout> 40 #include <QPushButton> 41 #include <QGridLayout> 43 #include <QMessageBox> 53 : QWidget(parent), config_data_(config_data)
56 QVBoxLayout* layout =
new QVBoxLayout();
59 title_ =
new QLabel(
"",
this);
60 QFont group_title_font(QFont().defaultFamily(), 12, QFont::Bold);
61 title_->setFont(group_title_font);
71 QGridLayout* form_grid =
new QGridLayout();
72 form_grid->setContentsMargins(20, 20, 20, 20);
75 QLabel* base_link_label =
new QLabel(
"Base Link",
this);
76 form_grid->addWidget(base_link_label, 0, 0, Qt::AlignRight);
82 QPushButton* btn_base_link =
new QPushButton(
"Choose Selected",
this);
84 form_grid->addWidget(btn_base_link, 0, 2, Qt::AlignLeft);
87 QLabel* tip_link_label =
new QLabel(
"Tip Link",
this);
88 form_grid->addWidget(tip_link_label, 1, 0, Qt::AlignRight);
94 QPushButton* btn_tip_link =
new QPushButton(
"Choose Selected",
this);
96 form_grid->addWidget(btn_tip_link, 1, 2, Qt::AlignLeft);
99 layout->addLayout(form_grid);
102 QHBoxLayout* controls_layout =
new QHBoxLayout();
105 QLabel* expand_controls =
new QLabel(
this);
106 expand_controls->setText(
"<a href='expand'>Expand All</a> <a href='contract'>Collapse All</a>");
107 connect(expand_controls, SIGNAL(linkActivated(
const QString)),
this, SLOT(
alterTree(
const QString)));
108 controls_layout->addWidget(expand_controls);
111 QWidget* spacer =
new QWidget(
this);
112 spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
113 controls_layout->addWidget(spacer);
116 QPushButton* btn_save =
new QPushButton(
"&Save",
this);
117 btn_save->setMaximumWidth(200);
118 connect(btn_save, SIGNAL(clicked()),
this, SIGNAL(
doneEditing()));
119 controls_layout->addWidget(btn_save);
120 controls_layout->setAlignment(btn_save, Qt::AlignRight);
123 QPushButton* btn_cancel =
new QPushButton(
"&Cancel",
this);
124 btn_cancel->setMaximumWidth(200);
125 connect(btn_cancel, SIGNAL(clicked()),
this, SIGNAL(
cancelEditing()));
126 controls_layout->addWidget(btn_cancel);
127 controls_layout->setAlignment(btn_cancel, Qt::AlignRight);
130 layout->addLayout(controls_layout);
133 this->setLayout(layout);
149 const robot_model::RobotModelConstPtr& model =
config_data_->getRobotModel();
152 const robot_model::JointModel* root_joint = model->getRootJoint();
164 const robot_model::LinkModel* parent)
167 QTreeWidgetItem* new_item =
new QTreeWidgetItem(
link_tree_);
172 new_item->setText(0, link->getName().c_str());
177 for (
int i = 0; i <
link_tree_->topLevelItemCount(); i++)
185 for (std::size_t i = 0; i < link->getChildJointModels().size(); i++)
195 const std::string& parent_name)
197 if (parent->text(0).toStdString() == parent_name)
199 QTreeWidgetItem* new_item =
new QTreeWidgetItem(parent);
200 new_item->setText(0, link->getName().c_str());
202 parent->addChild(new_item);
207 for (
int i = 0; i < parent->childCount(); i++)
233 QTreeWidgetItem* item =
link_tree_->currentItem();
245 QTreeWidgetItem* item =
link_tree_->currentItem();
257 if (link.contains(
"expand"))
268 QTreeWidgetItem* item =
link_tree_->currentItem();
273 std::string
name = item->text(0).toStdString();
280 Q_EMIT
highlightLink(item->text(0).toStdString(), QColor(255, 0, 0));