On Saturday 27 September 2008 14:35:09 Matias D'Ambrosio wrote:
> Even this method could be better by
> having some extra background to the sides, but it seems it ignores leading
> and trailing whitespace.
It doesn't, I made a mistake :-) Here is a corrected patch that adds a space
before and after the string for even better visibility.
Index: MapView.cpp
===================================================================
--- MapView.cpp (revision 10950)
+++ MapView.cpp (working copy)
@@ -231,10 +231,12 @@
QPointF P2(20+Length*projection().pixelPerM(),height()-20);
P.drawLine(P1-QPointF(0,5),P1+QPointF(0,5));
P.drawLine(P1,P2);
+ P.setBackgroundMode(Qt::OpaqueMode);
if (Length < 1000)
- P.drawText(QRectF(P2-QPoint(100,40),QSize(200,30)),Qt::AlignHCenter | Qt::AlignBottom, QString(tr("%1 m")).arg(Length, 0, 'f', 0));
+ P.drawText(QRectF(P2-QPoint(100,40),QSize(200,30)),Qt::AlignHCenter | Qt::AlignBottom, QString(tr(" %1 m ")).arg(Length, 0, 'f', 0));
else
- P.drawText(QRectF(P2-QPoint(100,40),QSize(200,30)),Qt::AlignHCenter | Qt::AlignBottom, QString(tr("%1 km")).arg(Length/1000, 0, 'f', 0));
+ P.drawText(QRectF(P2-QPoint(100,40),QSize(200,30)),Qt::AlignHCenter | Qt::AlignBottom, QString(tr(" %1 km ")).arg(Length/1000, 0, 'f', 0));
+ P.setBackgroundMode(Qt::TransparentMode);
P.drawLine(P2-QPointF(0,5),P2+QPointF(0,5));
}
_______________________________________________
Merkaartor mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/merkaartor