I'm trying to allow the user to be able to alter the points of a shape. If I create one Rectangle I'm able to alter each point however, the second I add another Rectangle It only alters the points of the first shape and moves the first shape over the new Rectangle.
for (int i = 0; i < ShapePointsOnly.count(); i++) {
int pointShapeX = ShapePointsOnly.at(i).x();
int pointShapeY = ShapePointsOnly.at(i).y();
if (mouseX >= pointShapeX - 10 && mouseX <= pointShapeX + 10) {
if (mouseY >= pointShapeY - 10 && mouseY <= pointShapeY + 10) {
tempValue.setX(pointShapeX);
tempValue.setY(pointShapeY);
selectedPoint = ShapePointsOnly.indexOf(tempValue);
userCanChangePoints = true;
return true;
}
}
}
QBrush noBrush(Qt::NoBrush);
QPen blackPen(Qt::black);
blackPen.setWidth(0);
Rectangle.append(QPointF(300, 300));
Rectangle.append(QPointF(300, 400));
Rectangle.append(QPointF(400, 400));
Rectangle.append(QPointF(400, 300));
RectangleConverted = Rectangle.toPolygon();
scene -> addPolygon(RectangleConverted);
numberOfShapesAdded = numberOfShapesAdded + 1;
addShapesToList();