]> sigrok.org Git - pulseview.git/commitdiff
CursorHeader: Paint by the labels by the time item list
authorJoel Holdsworth <redacted>
Tue, 9 Dec 2014 00:32:51 +0000 (00:32 +0000)
committerUwe Hermann <redacted>
Wed, 10 Dec 2014 17:06:16 +0000 (18:06 +0100)
pv/view/cursorheader.cpp
pv/view/cursorpair.cpp

index 981a958b8d0d94ec3d515fcfba3dce82844c8d76..e308867cfd9f0335850a83b309ae563ce9b810a8 100644 (file)
@@ -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<TimeItem> > items(view_.time_items());
+       for (auto &m : items)
+               m->paint_label(p, r);
 }
 
 void CursorHeader::mouseMoveEvent(QMouseEvent *e)
index 2ff32c53ef9fbbe4d46b2d1d8fb22425ee03626f..ecce13893def06fb3e4c3f8559d412ef8d2fa5cc 100644 (file)
@@ -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,