summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-25 13:01:23 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-25 13:01:23 (GMT)
commit721ee30a107f47e62ce276a62f92b1d2586e9090 (patch)
tree46a2942f02eaa3efaa259069fa252f1cc6412ba8
parente101518d1697756ef209c7ccbd94425bae46e6bd (diff)
Draw horizontally centered labels on top of their icons, not below.
Seems more widespread. This works around an issue in label pixmap calculation where we assume the label text to be quite some pixel higher than they really are, resulting in odd looking vertical space. Previously that was softened with the factor 1.5, which is the wrong approach though and lead to symbol/label overlaps in some cases. TODO FIXME: At least in Glow mode the labelPixmap has a bunch of empty (transparent) pixel rows on top, originating from a wrong text height calculation. This wastes some memory, costs some render performance, and prevents squeezing more items into roomForLabel().
-rw-r--r--src/lib/marble/PlacemarkLayout.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/marble/PlacemarkLayout.cpp b/src/lib/marble/PlacemarkLayout.cpp
index 56d917e..eb7a37f 100644
--- a/src/lib/marble/PlacemarkLayout.cpp
+++ b/src/lib/marble/PlacemarkLayout.cpp
@@ -665,8 +665,8 @@ QRectF PlacemarkLayout::roomForLabel( const GeoDataStyle::ConstPtr &style,
}
}
else if ( style->labelStyle().alignment() == GeoDataLabelStyle::Center ) {
- int const offsetY = style->iconStyle().scaledIcon().height() / 1.5;
- QRectF labelRect( x - textWidth / 2, offsetY + y - textHeight / 2,
+ int const offsetY = style->iconStyle().scaledIcon().height() / 2.0;
+ QRectF labelRect( x - textWidth / 2, y - offsetY - textHeight,
textWidth, textHeight );
if (hasRoomFor(currentsec, labelRect)) {