- QString s;
- QTextStream ts(&s);
- ts << (t / order_decimal) << SIPrefixes[prefix] << "s";
- p.drawText(x, 0, 0, text_height, Qt::AlignCenter | Qt::AlignTop |
- Qt::TextDontClip, s);
- p.drawLine(x, text_height, x, RulerHeight);
- t += tick_period;
+ const double t = t0 + division * minor_tick_period;
+ const double x = (t - _offset) / _scale + LabelMarginWidth;
+
+ if(x >= width())
+ break;
+
+ if(division % MinorTickSubdivision == 0)
+ {
+ // Draw a major tick
+ QString s;
+ QTextStream ts(&s);
+ ts << (t / order_decimal) << SIPrefixes[prefix] << "s";
+ p.drawText(x, 0, 0, text_height, Qt::AlignCenter | Qt::AlignTop |
+ Qt::TextDontClip, s);
+ p.drawLine(x, text_height, x, RulerHeight);
+ }
+ else
+ {
+ // Draw a minor tick
+ p.drawLine(x, (text_height + RulerHeight) / 2, x, RulerHeight);
+ }
+
+ division++;