const int Trace::LabelHitPadding = 2;
Trace::Trace(QString name) :
- _view(NULL),
_name(name),
- _v_offset(0),
_popup(NULL),
_popup_form(NULL)
{
_colour = colour;
}
-int Trace::get_v_offset() const
-{
- return _v_offset;
-}
-
-void Trace::set_v_offset(int v_offset)
-{
- _v_offset = v_offset;
-}
-
-void Trace::set_view(pv::view::View *view)
-{
- assert(view);
- _view = view;
-}
-
-void Trace::paint_back(QPainter &p, int left, int right)
-{
- (void)p;
- (void)left;
- (void)right;
-}
-
-void Trace::paint_mid(QPainter &p, int left, int right)
-{
- (void)p;
- (void)left;
- (void)right;
-}
-
-void Trace::paint_fore(QPainter &p, int left, int right)
-{
- (void)p;
- (void)left;
- (void)right;
-}
-
void Trace::paint_label(QPainter &p, int right, bool hover)
{
- assert(_view);
- const int y = _v_offset - _view->v_offset();
+ const int y = get_y();
p.setBrush(_colour);
Qt::AlignCenter | Qt::AlignVCenter, _name);
}
-bool Trace::pt_in_label_rect(int left, int right, const QPoint &point)
-{
- (void)left;
- return enabled() && label_rect(right).contains(point);
-}
-
QMenu* Trace::create_context_menu(QWidget *parent)
{
QMenu *const menu = SelectableItem::create_context_menu(parent);
return _popup;
}
-int Trace::get_y() const
-{
- return _v_offset - _view->v_offset();
-}
-
QRectF Trace::label_rect(int right)
{
using pv::view::View;
- assert(_view);
-
QFontMetrics m(QApplication::font());
const QSize text_size(
m.boundingRect(QRect(), 0, _name).width(),
label_size.height());
}
-void Trace::hover_point_changed()
-{
-}
-
QColor Trace::get_text_colour() const
{
return (_colour.lightness() > 64) ? Qt::black : Qt::white;