+void Header::contextMenuEvent(QContextMenuEvent *event)
+{
+ const shared_ptr<Signal> s = get_mouse_over_signal(_mouse_point);
+
+ if (!s)
+ return;
+
+ QMenu menu(this);
+ menu.addAction(_action_set_name);
+ menu.addAction(_action_set_colour);
+
+ _context_signal = s;
+ menu.exec(event->globalPos());
+ _context_signal.reset();
+}
+
+void Header::on_action_set_name_triggered()
+{
+ shared_ptr<view::Signal> context_signal = _context_signal;
+ if (!context_signal)
+ return;
+
+ const QString new_label = QInputDialog::getText(this, tr("Set Name"),
+ tr("Name"), QLineEdit::Normal, context_signal->get_name());
+
+ if (!new_label.isEmpty())
+ context_signal->set_name(new_label);
+}
+
+void Header::on_action_set_colour_triggered()
+{
+ shared_ptr<view::Signal> context_signal = _context_signal;
+ if (!context_signal)
+ return;
+
+ const QColor new_colour = QColorDialog::getColor(
+ context_signal->get_colour(), this, tr("Set Colour"));
+
+ if (new_colour.isValid())
+ context_signal->set_colour(new_colour);
+}
+
+void Header::on_signals_moved()
+{
+ update();
+}
+
+