second_->set_time(time + delta);
}
+float CursorPair::get_x() const
+{
+ return (first_->get_x() + second_->get_x()) / 2.0f;
+}
+
QPoint CursorPair::point() const
{
return first_->point();
right - left, height);
}
-void CursorPair::draw_markers(QPainter &p, const QRect &rect)
+void CursorPair::paint_label(QPainter &p, const QRect &rect)
{
assert(first_);
assert(second_);
+ if (!enabled())
+ return;
+
const unsigned int prefix = view_.tick_prefix();
compute_text_size(p, prefix);
{
const int highlight_radius = delta_rect.height() / 2 - 2;
+ if (selected()) {
+ p.setBrush(Qt::transparent);
+ p.setPen(highlight_pen());
+ p.drawRoundedRect(delta_rect, radius, radius);
+ }
+
p.setBrush(Cursor::FillColour);
p.setPen(Cursor::FillColour.darker());
p.drawRoundedRect(delta_rect, radius, radius);
p.drawText(text_rect, Qt::AlignCenter | Qt::AlignVCenter,
pv::util::format_time(second_->time() - first_->time(), prefix, 2));
}
-
- // Paint the cursor markers
- first_->paint_label(p, rect);
- second_->paint_label(p, rect);
}
void CursorPair::draw_viewport_background(QPainter &p,