X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fruler.cpp;h=84a6a2d736afd250cb22bf6bda4d7f3e2135a24c;hb=190fc91a86d732c7c9d14603b6bf263894a0e159;hp=27db2f4e844e2398320f9a944026ec084687c59a;hpb=ccdd3ef548ce34f25c6c168598556a350831aa37;p=pulseview.git diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 27db2f4..84a6a2d 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * @@ -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());