projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f6be412
)
Fixed ruler scale units
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Thu, 11 Oct 2012 20:38:24 +0000
(21:38 +0100)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Thu, 11 Oct 2012 20:38:24 +0000
(21:38 +0100)
pv/view/ruler.cpp
patch
|
blob
|
history
diff --git
a/pv/view/ruler.cpp
b/pv/view/ruler.cpp
index 27db2f4e844e2398320f9a944026ec084687c59a..743a11fcb9e5e3e40afdfb782adbad7e85eb8708 100644
(file)
--- 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));
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();
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);
// 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());
p.drawText(x, 0, 0, text_height, Qt::AlignCenter |
Qt::AlignTop | Qt::TextDontClip, s);
p.drawLine(x, text_height, x, height());