From: Joel Holdsworth Date: Mon, 8 Dec 2014 23:45:05 +0000 (+0000) Subject: TimeItem: Made paint_label a mandatory field X-Git-Tag: pulseview-0.3.0~373 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2fae5107535c39adde322393d2f6d18098c0154e;p=pulseview.git TimeItem: Made paint_label a mandatory field --- diff --git a/pv/view/cursorheader.cpp b/pv/view/cursorheader.cpp index 7fc02add..981a958b 100644 --- a/pv/view/cursorheader.cpp +++ b/pv/view/cursorheader.cpp @@ -78,7 +78,7 @@ void CursorHeader::paintEvent(QPaintEvent*) // Draw the cursors if (view_.cursors_shown()) - view_.cursors()->draw_markers(p, r); + view_.cursors()->paint_label(p, r); } void CursorHeader::mouseMoveEvent(QMouseEvent *e) diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 2ad8eef6..2ff32c53 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -101,7 +101,7 @@ QRectF CursorPair::label_rect(const QRectF &rect) const 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_); diff --git a/pv/view/cursorpair.hpp b/pv/view/cursorpair.hpp index 43e06545..47ca694b 100644 --- a/pv/view/cursorpair.hpp +++ b/pv/view/cursorpair.hpp @@ -74,7 +74,7 @@ public: public: QRectF label_rect(const QRectF &rect) const; - void draw_markers(QPainter &p, const QRect &rect); + void paint_label(QPainter &p, const QRect &rect); void draw_viewport_background(QPainter &p, const QRect &rect); diff --git a/pv/view/timeitem.hpp b/pv/view/timeitem.hpp index ff2664a6..02d22d21 100644 --- a/pv/view/timeitem.hpp +++ b/pv/view/timeitem.hpp @@ -47,6 +47,13 @@ public: virtual float get_x() const = 0; + /** + * Paints the marker's label to the ruler. + * @param p The painter to draw with. + * @param rect The rectangle of the ruler client area. + */ + virtual void paint_label(QPainter &p, const QRect &rect) = 0; + protected: View &view_; };