MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / mouseMoveEvent

Method mouseMoveEvent

ASAP/annotation/AnnotationTool.cpp:23–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23void AnnotationTool::mouseMoveEvent(QMouseEvent *event) {
24 if (_viewer) {
25 if (_generating) {
26 QPointF scenePos = _viewer->mapToScene(event->pos());
27 if (event->buttons() == Qt::LeftButton) {
28 if (QLineF(_viewer->mapFromScene(scenePos), _viewer->mapFromScene(QPointF(_last.getX(), _last.getY()))).length() > 40) {
29 addCoordinate(scenePos);
30 }
31 }
32 }
33 else if (_startSelectionMove && event->modifiers() == Qt::AltModifier) {
34 QPointF scenePos = _viewer->mapToScene(event->pos());
35 QSet<QtAnnotation*> selected = _annotationPlugin->getSelectedAnnotations();
36 for (QSet<QtAnnotation*>::iterator it = selected.begin(); it != selected.end(); ++it) {
37 QPointF delta = (scenePos - _moveStart);
38 (*it)->moveCoordinatesBy(Point(delta.x(), delta.y()));
39 }
40 _moveStart = scenePos;
41 }
42 else if (_startSelectionMove) {
43 QPointF scenePos = _viewer->mapToScene(event->pos());
44 QtAnnotation* active = _annotationPlugin->getActiveAnnotation();
45 if (active && active->getEditable()) {
46 int activeSeedPoint = active->getActiveSeedPoint();
47 if (activeSeedPoint >= 0) {
48 QPointF delta = (scenePos - _moveStart);
49 active->moveCoordinateBy(activeSeedPoint, Point(delta.x(), delta.y()));
50 _moveStart = scenePos;
51 }
52 }
53 }
54 event->accept();
55 }
56}
57
58void AnnotationTool::mouseDoubleClickEvent(QMouseEvent *event) {
59}

Callers

nothing calls this directly

Calls 7

PointClass · 0.85
getActiveAnnotationMethod · 0.80
getEditableMethod · 0.80
getActiveSeedPointMethod · 0.80
moveCoordinatesByMethod · 0.45
moveCoordinateByMethod · 0.45

Tested by

no test coverage detected