From 9a3774933c3051262af1f0e3ec4bd747fd6b4f48 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Tue, 9 Dec 2014 00:32:51 +0000 Subject: [PATCH] CursorHeader: Paint by the labels by the time item list --- pv/view/cursorheader.cpp | 7 ++++--- pv/view/cursorpair.cpp | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pv/view/cursorheader.cpp b/pv/view/cursorheader.cpp index 981a958..e308867 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 2ff32c5..ecce138 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, -- 2.30.2