summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-07-24 17:37:45 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-07-24 17:37:45 (GMT)
commit15f981159cdf90b6c7b4a5b54996db9142d26bb8 (patch)
treec9934896d4239bb5c3541bcebf28ab12d6be7115
parentf9efd262efff5390012788fc8bbf9e5f4319e001 (diff)
Avoid that labels repeat extremely often when the text is short.
Text with less than 20 chars is treated as text with 20 chars now. Feels a bit like a hack, please review for pitfalls. CCMAIL: tackat@kde.org
-rw-r--r--src/lib/marble/GeoPainter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/marble/GeoPainter.cpp b/src/lib/marble/GeoPainter.cpp
index 2030793..6d7ae26 100644
--- a/src/lib/marble/GeoPainter.cpp
+++ b/src/lib/marble/GeoPainter.cpp
@@ -558,6 +558,9 @@ void GeoPainter::drawPolyline ( const GeoDataLineString & lineString,
font.setPointSizeF(fontSize);
setFont(font);
int labelWidth = fontMetrics().width( labelText );
+ if (labelText.size() < 20) {
+ labelWidth *= (20.0 / labelText.size());
+ }
QPainterPath path;
path.addPolygon(*itPolygon);