X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fsignal.cpp;h=8fed4273e86d40beeac77329f60e60f0c6f9ecf7;hp=02732ffc7a19112d3e6fc236b7beea57ccf6ed8c;hb=e3374498baf2b2a05889cab370442ff326b390b3;hpb=2e57535108a0ae2e5d1ee454f1e61b71d23afdb3 diff --git a/pv/view/signal.cpp b/pv/view/signal.cpp index 02732ffc..8fed4273 100644 --- a/pv/view/signal.cpp +++ b/pv/view/signal.cpp @@ -20,6 +20,8 @@ #include +#include + #include "signal.h" #include "view.h" @@ -27,10 +29,12 @@ namespace pv { namespace view { const int Signal::LabelHitPadding = 2; +const int Signal::LabelHighlightRadius = 6; Signal::Signal(QString name) : _name(name), - _v_offset(0) + _v_offset(0), + _selected(false) { } @@ -64,6 +68,16 @@ void Signal::set_v_offset(int v_offset) _v_offset = v_offset; } +bool Signal::selected() const +{ + return _selected; +} + +void Signal::select(bool select) +{ + _selected = select; +} + void Signal::paint_label(QPainter &p, const QRect &rect, bool hover) { p.setBrush(_colour); @@ -91,6 +105,14 @@ void Signal::paint_label(QPainter &p, const QRect &rect, bool hover) QPointF(label_rect.left() + 1, label_rect.bottom() - 1) }; + if(_selected) { + p.setPen(QPen(QApplication::palette().brush( + QPalette::Highlight), LabelHighlightRadius, + Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + p.setBrush(Qt::transparent); + p.drawPolygon(points, countof(points)); + } + p.setPen(Qt::transparent); p.setBrush(hover ? colour.lighter() : colour); p.drawPolygon(points, countof(points));