mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-31 09:05:14 +01:00
Show the arrows even when no label is set
This commit is contained in:
parent
6ce2a63a1c
commit
dcf45475ba
@ -320,9 +320,6 @@ void RasterTile::processStreetNames(const QList<MapData::Poly> &lines,
|
||||
|
||||
if (style.img().isNull() && style.foreground() == Qt::NoPen)
|
||||
continue;
|
||||
if (poly.label.text().isEmpty()
|
||||
|| style.textFontSize() == Style::None)
|
||||
continue;
|
||||
|
||||
const QFont *fnt = font(style.textFontSize(), Style::Small);
|
||||
const QColor *color = style.textColor().isValid()
|
||||
@ -331,9 +328,14 @@ void RasterTile::processStreetNames(const QList<MapData::Poly> &lines,
|
||||
const QImage *img = poly.oneway
|
||||
? Style::isWaterLine(poly.type)
|
||||
? &waterArrow : &arrow : 0;
|
||||
const QString *label = poly.label.text().isEmpty()
|
||||
? 0 : &poly.label.text();
|
||||
|
||||
TextPathItem *item = new TextPathItem(poly.points,
|
||||
&poly.label.text(), _rect, fnt, color, hColor, img);
|
||||
if (!img && (!label || !fnt))
|
||||
continue;
|
||||
|
||||
TextPathItem *item = new TextPathItem(poly.points, label, _rect, fnt,
|
||||
color, hColor, img);
|
||||
if (item->isValid() && !item->collides(textItems))
|
||||
textItems.append(item);
|
||||
else {
|
||||
|
@ -263,12 +263,15 @@ template<class T>
|
||||
void TextPathItem::init(const T &line, const QRect &tileRect)
|
||||
{
|
||||
qreal cw, mw, textWidth;
|
||||
bool label = _text && _font;
|
||||
|
||||
if (_text && _img) {
|
||||
Q_ASSERT(label || _img);
|
||||
|
||||
if (label && _img) {
|
||||
cw = _font->pixelSize() * CHAR_RATIO;
|
||||
mw = _font->pixelSize() / 2.0;
|
||||
textWidth = _text->size() * cw + _img->width() + PADDING;
|
||||
} else if (_text) {
|
||||
} else if (label) {
|
||||
cw = _font->pixelSize() * CHAR_RATIO;
|
||||
mw = _font->pixelSize() / 2.0;
|
||||
textWidth = _text->size() * cw;
|
||||
@ -328,7 +331,7 @@ void TextPathItem::paint(QPainter *painter) const
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
if (_text) {
|
||||
if (_text && _font) {
|
||||
QFontMetrics fm(*_font);
|
||||
int textWidth = fm.boundingRect(*_text).width();
|
||||
int imgWidth = _img ? _img->width() + PADDING : 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user