I am coding a tool that enables to draw polygons. I want them to be simple polygons and forbid drawing complex polygons.
I have tried ToSubpathPolygons()
I have the list of QPoints that form the polygon.
I am coding in c++ + Qt. I think I could try with segment intersections and if there is an intersection it is not simple.
I thought qpainterpath tosubpathPolygons should give me more than one if it is a complex polygon. The problem should be something like this:
if(q.toSubpathPolygons().length()==1)
{
//whatever
}
else{
cout<<"not a polygon"<<endl;
}