From: Joel Holdsworth Date: Mon, 24 Nov 2014 19:17:27 +0000 (+0000) Subject: Trace: Make paint_axis take RowItemPaintParams X-Git-Tag: pulseview-0.3.0~401 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=97904bf71258d3b522b00eb3dcae1efea6bd1298;p=pulseview.git Trace: Make paint_axis take RowItemPaintParams --- diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index a7a69218..325ab6bd 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -90,7 +90,7 @@ std::pair AnalogSignal::v_extents() const void AnalogSignal::paint_back(QPainter &p, const RowItemPaintParams &pp) { if (channel_->enabled()) - paint_axis(p, get_visual_y(), pp.left(), pp.right()); + paint_axis(p, pp, get_visual_y()); } void AnalogSignal::paint_mid(QPainter &p, const RowItemPaintParams &pp) diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index 7ed66b3e..0b129c3b 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -169,7 +169,7 @@ pair DecodeTrace::v_extents() const void DecodeTrace::paint_back(QPainter &p, const RowItemPaintParams &pp) { Trace::paint_back(p, pp); - paint_axis(p, get_visual_y(), pp.left(), pp.right()); + paint_axis(p, pp, get_visual_y()); } void DecodeTrace::paint_mid(QPainter &p, const RowItemPaintParams &pp) diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index af992c6b..1ee99cb9 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -148,7 +148,7 @@ std::pair LogicSignal::v_extents() const void LogicSignal::paint_back(QPainter &p, const RowItemPaintParams &pp) { if (channel_->enabled()) - paint_axis(p, get_visual_y(), pp.left(), pp.right()); + paint_axis(p, pp, get_visual_y()); } void LogicSignal::paint_mid(QPainter &p, const RowItemPaintParams &pp) diff --git a/pv/view/trace.cpp b/pv/view/trace.cpp index 1734921a..fd440185 100644 --- a/pv/view/trace.cpp +++ b/pv/view/trace.cpp @@ -167,10 +167,10 @@ QColor Trace::get_text_colour() const return (colour_.lightness() > 64) ? Qt::black : Qt::white; } -void Trace::paint_axis(QPainter &p, int y, int left, int right) +void Trace::paint_axis(QPainter &p, const RowItemPaintParams &pp, int y) { p.setPen(AxisPen); - p.drawLine(QPointF(left, y + 0.5f), QPointF(right, y + 0.5f)); + p.drawLine(QPointF(pp.left(), y + 0.5f), QPointF(pp.right(), y + 0.5f)); } void Trace::add_colour_option(QWidget *parent, QFormLayout *form) diff --git a/pv/view/trace.hpp b/pv/view/trace.hpp index 88df33ea..c0b94df2 100644 --- a/pv/view/trace.hpp +++ b/pv/view/trace.hpp @@ -107,11 +107,10 @@ protected: /** * Paints a zero axis across the viewport. * @param p the QPainter to paint into. + * @param pp the painting parameters object to paint with. * @param y the y-offset of the axis. - * @param left the x-coordinate of the left edge of the view. - * @param right the x-coordinate of the right edge of the view. */ - void paint_axis(QPainter &p, int y, int left, int right); + void paint_axis(QPainter &p, const RowItemPaintParams &pp, int y); void add_colour_option(QWidget *parent, QFormLayout *form);