37 #include <QVBoxLayout> 38 #include <QHBoxLayout> 40 #include <QPushButton> 41 #include <QFormLayout> 43 #include <QMessageBox> 45 #include <QHeaderView> 54 QString long_name, QString short_name,
bool add_ok_cancel)
55 : QWidget(parent), long_name_(long_name), short_name_(short_name), config_data_(config_data)
58 QVBoxLayout* layout =
new QVBoxLayout();
61 title_ =
new QLabel(
"",
this);
62 QFont group_title_font(QFont().defaultFamily(), 12, QFont::Bold);
63 title_->setFont(group_title_font);
67 QHBoxLayout* hlayout =
new QHBoxLayout();
70 QVBoxLayout* column1 =
new QVBoxLayout();
81 connect(
data_table_->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
this,
85 QStringList data_header_list;
86 data_header_list.append(QString(
" Names").prepend(
short_name_));
87 data_table_->setHorizontalHeaderLabels(data_header_list);
88 data_table_->horizontalHeader()->setDefaultAlignment(Qt::AlignHCenter);
91 hlayout->addLayout(column1);
94 QVBoxLayout* column2 =
new QVBoxLayout();
95 column2->setSizeConstraint(QLayout::SetFixedSize);
98 QPushButton* btn_right =
new QPushButton(
">",
this);
99 btn_right->setMaximumSize(25, 80);
101 column2->addWidget(btn_right);
104 QPushButton* btn_left =
new QPushButton(
"<",
this);
105 btn_left->setMaximumSize(25, 80);
107 column2->addWidget(btn_left);
110 hlayout->addLayout(column2);
113 QVBoxLayout* column3 =
new QVBoxLayout();
124 connect(
selected_data_table_->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
this,
131 hlayout->addLayout(column3);
134 layout->addLayout(hlayout);
139 QHBoxLayout* controls_layout =
new QHBoxLayout();
140 controls_layout->setContentsMargins(0, 25, 0, 15);
143 QWidget* spacer =
new QWidget(
this);
144 spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
145 controls_layout->addWidget(spacer);
148 QPushButton* btn_save =
new QPushButton(
"&Save",
this);
150 connect(btn_save, SIGNAL(clicked()),
this, SIGNAL(
doneEditing()));
151 controls_layout->addWidget(btn_save);
152 controls_layout->setAlignment(btn_save, Qt::AlignRight);
155 QPushButton* btn_cancel =
new QPushButton(
"&Cancel",
this);
157 connect(btn_cancel, SIGNAL(clicked()),
this, SIGNAL(
cancelEditing()));
158 controls_layout->addWidget(btn_cancel);
159 controls_layout->setAlignment(btn_cancel, Qt::AlignRight);
162 layout->addLayout(controls_layout);
166 this->setLayout(layout);
207 table->setUpdatesEnabled(
false);
208 table->setDisabled(
true);
209 table->clearContents();
212 table->setRowCount(items.size());
216 for (std::vector<std::string>::const_iterator data_it = items.begin(); data_it != items.end(); ++data_it)
220 if (*data_it ==
"ASSUMED_FIXED_ROOT_JOINT")
224 QTableWidgetItem* data_name =
new QTableWidgetItem(data_it->c_str());
225 data_name->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
228 table->setItem(row, 0, data_name);
234 table->setRowCount(row);
237 table->setUpdatesEnabled(
true);
238 table->setDisabled(
false);
247 QList<QTableWidgetItem*> selected =
data_table_->selectedItems();
250 for (
int i = 0; i < selected.size(); i++)
252 std::string
name = selected[i]->text().toStdString();
253 bool alreadyExists =
false;
261 if (item->text().toStdString() == name)
263 alreadyExists =
true;
273 QTableWidgetItem* newItem =
new QTableWidgetItem(name.c_str());
274 newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
291 for (
int i = 0; i < deselected.size(); i++)
304 const QList<QTableWidgetItem*> selected_items =
data_table_->selectedItems();
323 if (!selected.size())
326 std::vector<std::string> selected_vector;
329 for (
int i = 0; i < selected.size(); ++i)
331 selected_vector.push_back(selected[i]->
text().toStdString());
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)