| 285 | } |
| 286 | |
| 287 | void Ruler::mousePressEvent(QMouseEvent *event) |
| 288 | { |
| 289 | if (event->button() & Qt::LeftButton) { |
| 290 | bool visible; |
| 291 | auto &cursor_list = _view.get_cursorList(); |
| 292 | |
| 293 | if (!_cursor_sel_visible && cursor_list.size()) { |
| 294 | _view.show_cursors(true); |
| 295 | auto i = cursor_list.begin(); |
| 296 | |
| 297 | while (i != cursor_list.end()) { |
| 298 | const QRect cursor_rect((*i)->get_label_rect(rect(), visible)); |
| 299 | if ((*i)->get_close_rect(cursor_rect).contains(event->pos())) { |
| 300 | _view.del_cursor(*i); |
| 301 | |
| 302 | if (cursor_list.empty()) { |
| 303 | _cursor_sel_visible = false; |
| 304 | _view.show_cursors(false); |
| 305 | } |
| 306 | _hitCursor = true; |
| 307 | break; |
| 308 | } |
| 309 | |
| 310 | if (cursor_rect.contains(event->pos())) { |
| 311 | set_grabbed_cursor(*i); |
| 312 | _cursor_sel_visible = false; |
| 313 | _cursor_go_visible = false; |
| 314 | _hitCursor = true; |
| 315 | break; |
| 316 | } |
| 317 | i++; |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | void Ruler::mouseReleaseEvent(QMouseEvent *event) |
| 324 | { |
nothing calls this directly
no test coverage detected