]> sigrok.org Git - pulseview.git/blobdiff - pv/view/ruler.cpp
Added cursors
[pulseview.git] / pv / view / ruler.cpp
index c5f194f2f76f4011009107659c2ad70790605e6f..83863e61ea203e3a3efb08f772425a8510da029d 100644 (file)
@@ -31,6 +31,8 @@
 #include <QPainter>
 #include <QTextStream>
 
 #include <QPainter>
 #include <QTextStream>
 
+using namespace std;
+
 namespace pv {
 namespace view {
 
 namespace pv {
 namespace view {
 
@@ -123,12 +125,26 @@ void Ruler::paintEvent(QPaintEvent *event)
                division++;
        }
 
                division++;
        }
 
+       // Draw the cursors
+       draw_cursors(p);
+
        // Draw the hover mark
        draw_hover_mark(p);
 
        p.end();
 }
 
        // Draw the hover mark
        draw_hover_mark(p);
 
        p.end();
 }
 
+void Ruler::draw_cursors(QPainter &p)
+{
+       if(!_view.cursors_shown())
+               return;
+
+       const QRect r = rect();
+       pair<Cursor, Cursor> &cursors = _view.cursors();
+       cursors.first.paint_label(p, r);
+       cursors.second.paint_label(p, r);
+}
+
 void Ruler::draw_hover_mark(QPainter &p)
 {
        const int x = _view.hover_point().x();
 void Ruler::draw_hover_mark(QPainter &p)
 {
        const int x = _view.hover_point().x();