1
0
mirror of git://projects.qi-hardware.com/nanomap.git synced 2024-11-28 01:03:08 +02:00

draw little arrow under marker pointing to exact location

This commit is contained in:
Niels 2010-06-13 11:58:38 +02:00
parent 327d963696
commit a76267346b

View File

@ -353,8 +353,17 @@ void MapWidget::paintEvent(QPaintEvent *event)
foreach (const QPointF &m, m_markerPos) {
QPoint pos = geo2screen(m.x(), m.y());
int w = fm.width(m_markerName.at(i)) / 2;
QRect rect(pos.x() - w, pos.y() - h, 2*w, 2*h);
painter.drawRect(rect.adjusted(-2, 0, 2, 0));
QRect rect(pos.x() - w - 2, pos.y() - h - 11, 2*w + 4, 2*h);
QPolygon polygon;
polygon << pos;
polygon << pos + QPoint(-2, -5);
polygon << rect.bottomLeft();
polygon << rect.topLeft();
polygon << rect.topRight();
polygon << rect.bottomRight();
polygon << pos + QPoint(2, -5);
polygon << pos;
painter.drawPolygon(polygon);
painter.drawText(rect, Qt::AlignCenter, m_markerName.at(i));
++i;
}