+ rect.right() - half_height - label_size.width() - 0.5,
+ get_visual_y() + 0.5f - half_height,
+ label_size.width() + half_height,
+ label_size.height());
+}
+
+void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y)
+{
+ p.setPen(AxisPen);
+ p.drawLine(QPointF(pp.left(), y + 0.5f), QPointF(pp.right(), y + 0.5f));
+}
+
+void Trace::add_colour_option(QWidget *parent, QFormLayout *form)
+{
+ using pv::widgets::ColourButton;
+
+ ColourButton *const colour_button = new ColourButton(
+ TracePalette::Rows, TracePalette::Cols, parent);
+ colour_button->set_palette(TracePalette::Colours);
+ colour_button->set_colour(colour_);
+ connect(colour_button, SIGNAL(selected(const QColor&)),
+ this, SLOT(on_colour_changed(const QColor&)));
+
+ form->addRow(tr("Colour"), colour_button);
+}
+
+void Trace::create_popup_form()
+{
+ // Clear the layout
+
+ // Transfer the layout and the child widgets to a temporary widget
+ // which then goes out of scope destroying the layout and all the child
+ // widgets.
+ if (popup_form_)
+ QWidget().setLayout(popup_form_);
+
+ // Repopulate the popup
+ popup_form_ = new QFormLayout(popup_);
+ popup_->setLayout(popup_form_);
+ populate_popup_form(popup_, popup_form_);
+}
+
+void Trace::populate_popup_form(QWidget *parent, QFormLayout *form)
+{
+ QLineEdit *const name_edit = new QLineEdit(parent);
+ name_edit->setText(name_);
+ connect(name_edit, SIGNAL(textChanged(const QString&)),
+ this, SLOT(on_text_changed(const QString&)));
+ form->addRow(tr("Name"), name_edit);
+
+ add_colour_option(parent, form);
+}
+
+void Trace::on_popup_closed()
+{
+ popup_ = NULL;
+ popup_form_ = NULL;
+}
+
+void Trace::on_text_changed(const QString &text)
+{
+ set_name(text);
+
+ if (owner_)
+ owner_->extents_changed(true, false);
+}
+
+void Trace::on_colour_changed(const QColor &colour)
+{
+ set_colour(colour);
+
+ if (owner_)
+ owner_->row_item_appearance_changed(true, false);