From 1b5813fe7a82d959976389f7bb41bf731f1ff435 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Thu, 11 Oct 2012 21:38:24 +0100 Subject: [PATCH] Fixed ruler scale units --- pv/view/ruler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 27db2f4e..743a11fc 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -68,6 +68,8 @@ void Ruler::paintEvent(QPaintEvent *event) assert(prefix >= 0); assert(prefix < countof(SIPrefixes)); + const double multiplier = pow(0.1, prefix * 3 + FirstSIPrefixPower); + const int text_height = p.boundingRect(0, 0, INT_MAX, INT_MAX, Qt::AlignLeft | Qt::AlignTop, "8").height(); @@ -96,7 +98,7 @@ void Ruler::paintEvent(QPaintEvent *event) // Draw a major tick QString s; QTextStream ts(&s); - ts << (t / order_decimal) << SIPrefixes[prefix] << "s"; + ts << (t * multiplier) << SIPrefixes[prefix] << "s"; p.drawText(x, 0, 0, text_height, Qt::AlignCenter | Qt::AlignTop | Qt::TextDontClip, s); p.drawLine(x, text_height, x, height()); -- 2.30.2