- p.setBrush(_colour);
-
- const QColor colour = get_colour();
- const float nominal_offset = get_nominal_offset(rect);
-
- compute_text_size(p);
- const QRectF label_rect = get_label_rect(rect);
-
- // Paint the label
- const QPointF points[] = {
- label_rect.topLeft(),
- label_rect.topRight(),
- QPointF(rect.right(), nominal_offset),
- label_rect.bottomRight(),
- label_rect.bottomLeft()
- };
-
- const QPointF highlight_points[] = {
- QPointF(label_rect.left() + 1, label_rect.top() + 1),
- QPointF(label_rect.right(), label_rect.top() + 1),
- QPointF(rect.right() - 1, nominal_offset),
- QPointF(label_rect.right(), label_rect.bottom() - 1),
- QPointF(label_rect.left() + 1, label_rect.bottom() - 1)
- };
-
- p.setPen(Qt::transparent);
- p.setBrush(hover ? colour.lighter() : colour);
- p.drawPolygon(points, countof(points));
-
- p.setPen(colour.lighter());
- p.setBrush(Qt::transparent);
- p.drawPolygon(highlight_points, countof(highlight_points));
-
- p.setPen(colour.darker());
- p.setBrush(Qt::transparent);
- p.drawPolygon(points, countof(points));
-
- // Paint the text
- p.setPen((colour.lightness() > 64) ? Qt::black : Qt::white);
- p.drawText(label_rect, Qt::AlignCenter | Qt::AlignVCenter, _name);
+ name_widget_ = new QComboBox(parent);
+ name_widget_->setEditable(true);
+ name_widget_->setCompleter(0);
+
+ for(unsigned int i = 0; i < countof(ChannelNames); i++)
+ name_widget_->insertItem(i, ChannelNames[i]);
+
+ const int index = name_widget_->findText(name_, Qt::MatchExactly);
+
+ if (index == -1) {
+ name_widget_->insertItem(0, name_);
+ name_widget_->setCurrentIndex(0);
+ } else {
+ name_widget_->setCurrentIndex(index);
+ }
+
+ connect(name_widget_, SIGNAL(editTextChanged(const QString&)),
+ this, SLOT(on_text_changed(const QString&)));
+
+ form->addRow(tr("Name"), name_widget_);
+
+ add_colour_option(parent, form);