In a qgraphicsItem using QPainterPath in paint() function i have drawn a free form drawing over the scene.I'd like to ask if there's a way to calculate the area of a closed painter path. I'd like to display the area the painterpath covered in the scene not as the boundingRect.
To calculate area of polygon you can do in two ways:
slow but universal (there might be problem with precision): get point from pointAtPercent with some step and perform standard calculation for such polygon
fast but will work only for QPainterPath which segments are LineToElement. Just iterate through all polygon corners using elementAt and elementCount and again perform standard calculation to calculate area of polygon.