I have a QPainterPath of a point path, which is the path of a machine. I draw that path with a QPainterPathStroke and up there all right. The problem is that this path could pass over itself, that is, overlap or maybe just touch it and in that case I would like to be able to paint that part of the overlay with another color. Can it be determined if a QPainterPath or QPainterPathStroke passes over itself ?. I leave the code of what I have:
QPainterPath path;
path.moveTo(points.at(0));
int i=1;
while (i + 2 < points.size()) {
path.cubicTo(points.at(i), points.at(i+1), points.at(i+2));
i += 3;
}
while (i < points.size()) {
path.lineTo(points.at(i));
++i;
}
QPainterPathStroker stroker;
stroker.setWidth(24);
QPainterPath stroke = stroker.createStroke(path);
painter->fillPath(stroke, QColor(0,255,0, 128));
points is a QVector. The width of the painterpathstroke is 24 because that is the width of the machine.
Here I upload an image, where the crossing is seen ... it is the same qpainterpath that at one time makes a kind of 8 and passes over itself