Замена вектора из объектов Point на вектор из указателей на объекты Point #1

Merged
ParkSuMin merged 3 commits from point_ptr_QList into master 2025-12-09 17:12:54 +01:00
Showing only changes of commit 9d383f6410 - Show all commits

View File

@@ -34,9 +34,9 @@ Point* Canvas::findPointAt(QPointF pos, qreal tolerance)
QPointF p2(*line->p2.x, *line->p2.y);
if (dist_P2P(p1, pos) <= tolerance)
temp = &line->p1;
temp = line->p1_ref;
else if (dist_P2P(p2, pos) <= tolerance)
temp = &line->p2;
temp = line->p2_ref;
}
return temp;
}
@@ -214,8 +214,8 @@ void Canvas::mousePressEvent(QMouseEvent* event)
Line *l1 = nullptr, *l2 = nullptr;
for (Line* l : lines) {
if (&l->p1 == firstPoint || &l->p2 == firstPoint) l1 = l;
if (&l->p1 == clickedPoint || &l->p2 == clickedPoint) l2 = l;
if (l->p1_ref == firstPoint || l->p2_ref == firstPoint) l1 = l;
if (l->p1_ref == clickedPoint || l->p2_ref == clickedPoint) l2 = l;
}
if (l1 == l2 ||