mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-24 03:35:54 +01:00
Code cleanup
This commit is contained in:
parent
0dd83979cf
commit
c1a00d902e
@ -151,6 +151,7 @@ static void drawFeature(const Feature &feature, Style *style, int styleLayer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path.elementCount())
|
||||||
style->drawFeature(tile, styleLayer, path, feature.tags());
|
style->drawFeature(tile, styleLayer, path, feature.tags());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +152,6 @@ void Text::render(QPainter *painter) const
|
|||||||
void Text::addLabel(const QString &text, const QPointF &pos,
|
void Text::addLabel(const QString &text, const QPointF &pos,
|
||||||
const QPainter &painter, bool overlap, const QImage &icon)
|
const QPainter &painter, bool overlap, const QImage &icon)
|
||||||
{
|
{
|
||||||
if (text.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
TextPointItem *ti = new TextPointItem(text, pos, painter.font(),
|
TextPointItem *ti = new TextPointItem(text, pos, painter.font(),
|
||||||
_properties, icon);
|
_properties, icon);
|
||||||
if (!overlap && !_sceneRect.contains(ti->boundingRect())) {
|
if (!overlap && !_sceneRect.contains(ti->boundingRect())) {
|
||||||
@ -172,11 +169,6 @@ void Text::addLabel(const QString &text, const QPointF &pos,
|
|||||||
void Text::addLabel(const QString &text, const QPainterPath &path,
|
void Text::addLabel(const QString &text, const QPainterPath &path,
|
||||||
const QPainter &painter)
|
const QPainter &painter)
|
||||||
{
|
{
|
||||||
if (path.isEmpty())
|
|
||||||
return;
|
|
||||||
if (text.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
int textWidth = text.size() * painter.font().pixelSize() * 0.6;
|
int textWidth = text.size() * painter.font().pixelSize() * 0.6;
|
||||||
if (textWidth > path.length())
|
if (textWidth > path.length())
|
||||||
return;
|
return;
|
||||||
|
@ -30,7 +30,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Text(const QSize &size) : _sceneRect(QRectF(QPointF(0, 0), size)) {}
|
Text(const QSize &size)
|
||||||
|
: _sceneRect(QRectF(QPointF(0, 0), size)), _textPathPresent(false) {}
|
||||||
~Text();
|
~Text();
|
||||||
|
|
||||||
void setProperties(const Properties &prop)
|
void setProperties(const Properties &prop)
|
||||||
|
@ -17,6 +17,9 @@ TextPathItem::TextPathItem(const QString &text, const QPainterPath &path,
|
|||||||
|
|
||||||
void TextPathItem::paint(QPainter *painter) const
|
void TextPathItem::paint(QPainter *painter) const
|
||||||
{
|
{
|
||||||
|
//painter->setPen(Qt::red);
|
||||||
|
//painter->drawPath(_shape);
|
||||||
|
|
||||||
QFontMetrics fm(_font);
|
QFontMetrics fm(_font);
|
||||||
int textWidth = fm.width(text());
|
int textWidth = fm.width(text());
|
||||||
|
|
||||||
@ -40,7 +43,4 @@ void TextPathItem::paint(QPainter *painter) const
|
|||||||
int width = fm.charWidth(text(), i);
|
int width = fm.charWidth(text(), i);
|
||||||
percent += ((qreal)width / (qreal)textWidth) * factor;
|
percent += ((qreal)width / (qreal)textWidth) * factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//painter->setPen(Qt::red);
|
|
||||||
//painter->drawPath(_shape);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user