[Kst] branches/work/kst/portto4/kst/src/libkstapp
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Jul 10 00:26:39 UTC 2012
SVN commit 1304951 by netterfield:
A hacky heuristic to guess the right width of the widest number for very
small scientific notation numbers. This is not exact but seems to work.
M +8 -1 plotitem.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1304950:1304951
@@ -2564,7 +2564,14 @@
while (yLabelIt.hasNext()) {
yLabelIt.next();
- QRectF bound = painter->boundingRect(QRectF(), flags, yLabelIt.value());
+ // a hacky heuristic to guess the right width of the widest number for very small scientific notation numbers.
+ // 'label' is only used to find its width. This is not exact but seems to work.
+ QString label = yLabelIt.value();
+ if (label.contains("e-")) {
+ label.append('+');
+ }
+
+ QRectF bound = painter->boundingRect(QRectF(), flags, label);
QPointF p(plotRect().left() - bound.width() / 2.0 - _calculatedAxisMarginHLead, mapYToPlot(yLabelIt.key()));
bound.moveCenter(p);
More information about the Kst
mailing list