mirror of
git://projects.qi-hardware.com/nanomap.git
synced 2025-04-03 00:47:29 +03:00
draw little arrow under marker pointing to exact location
This commit is contained in:
parent
327d963696
commit
a76267346b
@ -353,8 +353,17 @@ void MapWidget::paintEvent(QPaintEvent *event)
|
|||||||
foreach (const QPointF &m, m_markerPos) {
|
foreach (const QPointF &m, m_markerPos) {
|
||||||
QPoint pos = geo2screen(m.x(), m.y());
|
QPoint pos = geo2screen(m.x(), m.y());
|
||||||
int w = fm.width(m_markerName.at(i)) / 2;
|
int w = fm.width(m_markerName.at(i)) / 2;
|
||||||
QRect rect(pos.x() - w, pos.y() - h, 2*w, 2*h);
|
QRect rect(pos.x() - w - 2, pos.y() - h - 11, 2*w + 4, 2*h);
|
||||||
painter.drawRect(rect.adjusted(-2, 0, 2, 0));
|
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));
|
painter.drawText(rect, Qt::AlignCenter, m_markerName.at(i));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user