From: Joel Holdsworth Date: Tue, 9 Dec 2014 00:32:51 +0000 (+0000) Subject: CursorHeader: Paint by the labels by the time item list X-Git-Tag: pulseview-0.3.0~371 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9a3774933c3051262af1f0e3ec4bd747fd6b4f48;p=pulseview.git CursorHeader: Paint by the labels by the time item list --- diff --git a/pv/view/cursorheader.cpp b/pv/view/cursorheader.cpp index 981a958b..e308867c 100644 --- a/pv/view/cursorheader.cpp +++ b/pv/view/cursorheader.cpp @@ -76,9 +76,10 @@ void CursorHeader::paintEvent(QPaintEvent*) // would be clipped away. const QRect r = rect().adjusted(0, 0, 0, -BaselineOffset); - // Draw the cursors - if (view_.cursors_shown()) - view_.cursors()->paint_label(p, r); + // Draw the items + const vector< shared_ptr > items(view_.time_items()); + for (auto &m : items) + m->paint_label(p, r); } void CursorHeader::mouseMoveEvent(QMouseEvent *e) diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 2ff32c53..ecce1389 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -106,6 +106,9 @@ 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); @@ -137,10 +140,6 @@ void CursorPair::paint_label(QPainter &p, const QRect &rect) 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,