| 144 | } |
| 145 | |
| 146 | void TouchCursor::paint(QPainter* painter) |
| 147 | { |
| 148 | if (!visible) |
| 149 | return; |
| 150 | |
| 151 | QPointF cursor_pos = map_widget->mapToViewport(cursor_coord); |
| 152 | |
| 153 | // Draw cursor |
| 154 | QPixmap cursor_pixmap = map_widget->cursor().pixmap(); |
| 155 | if (!cursor_pixmap.isNull()) |
| 156 | painter->drawPixmap(cursor_pos - map_widget->cursor().hotSpot(), cursor_pixmap); |
| 157 | else |
| 158 | { |
| 159 | // TODO: better standard "cursor"? |
| 160 | float cursor_radius = standardCursorRadiusPx(); |
| 161 | |
| 162 | painter->setPen(QPen(Qt::gray, controlRingStrokeRadiusPx())); |
| 163 | painter->setBrush(Qt::NoBrush); |
| 164 | painter->drawLine(cursor_pos - QPointF(cursor_radius, 0), cursor_pos + QPointF(cursor_radius, 0)); |
| 165 | painter->drawLine(cursor_pos - QPointF(0, cursor_radius), cursor_pos + QPointF(0, cursor_radius)); |
| 166 | } |
| 167 | |
| 168 | // Draw move handle / left button |
| 169 | painter->setPen(QPen(Qt::gray, controlRingStrokeRadiusPx())); |
| 170 | painter->setBrush(Qt::NoBrush); |
| 171 | painter->drawEllipse(cursor_pos + QPointF(0, touchPosOffsetPx()), controlRingRadiusPx(), controlRingRadiusPx()); |
| 172 | } |
| 173 | |
| 174 | bool TouchCursor::touchedControl(const QPoint& pos, TouchCursor::ControlID* out_id) |
| 175 | { |
no test coverage detected