From 64b678ba0bf16e3a3c1aceffef170f3dbcc588d3 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 13 Apr 2013 15:30:01 +0100 Subject: [PATCH] Draw numbers off the end of the ruler --- pv/view/ruler.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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); -- 2.30.2