X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fsignal.cpp;h=33cfef2d418839a588bc269ac36729b30e67ae2b;hb=333d5bbc0a326e6fa82db44f3e6ba8dd79cafdd8;hp=3e951b339bc261c319e3807249c2a4d91ae35462;hpb=8d634081d8b0cc741dd34d8c646474ff6754aea8;p=pulseview.git diff --git a/pv/view/signal.cpp b/pv/view/signal.cpp index 3e951b3..33cfef2 100644 --- a/pv/view/signal.cpp +++ b/pv/view/signal.cpp @@ -20,6 +20,8 @@ #include +#include + #include "signal.h" #include "view.h" @@ -27,9 +29,12 @@ namespace pv { namespace view { const int Signal::LabelHitPadding = 2; +const int Signal::LabelHighlightRadius = 6; Signal::Signal(QString name) : - _name(name) + _name(name), + _v_offset(0), + _selected(false) { } @@ -53,6 +58,26 @@ void Signal::set_colour(QColor colour) _colour = colour; } +int Signal::get_v_offset() const +{ + return _v_offset; +} + +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); @@ -80,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));