From: Joel Holdsworth Date: Sat, 13 Apr 2013 14:30:01 +0000 (+0100) Subject: Draw numbers off the end of the ruler X-Git-Tag: pulseview-0.1.0~42 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=64b678ba0bf16e3a3c1aceffef170f3dbcc588d3;p=pulseview.git Draw numbers off the end of the ruler --- diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index eb658e48..9e639383 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -130,19 +130,17 @@ void Ruler::paintEvent(QPaintEvent*) const double t0 = first_major_division * tick_period; int division = (int)round(first_minor_division - - first_major_division * MinorTickSubdivision); + first_major_division * MinorTickSubdivision) - 1; const int major_tick_y1 = text_height + ValueMargin * 2; const int tick_y2 = height(); const int minor_tick_y1 = (major_tick_y1 + tick_y2) / 2; - while (1) - { - const double t = t0 + division * minor_tick_period; - const double x = (t - _view.offset()) / _view.scale(); + double x; - if (x >= width()) - break; + do { + const double t = t0 + division * minor_tick_period; + x = (t - _view.offset()) / _view.scale(); if (division % MinorTickSubdivision == 0) { @@ -161,7 +159,8 @@ void Ruler::paintEvent(QPaintEvent*) } division++; - } + + } while (x < width()); // Draw the cursors draw_cursors(p, prefix);