Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

I want to know the total size of a shape drawn with Painter.



  • Hi everyone

    I'm using Linux 64Bit, Qt 5.4.0.

    Using the Painter's DrawPolygon, inside a rectangle of size from QPoint(0,0) to QPoint(100,100)
    I drew my brother.

    When the width of the pen is 1, it is drawn just inside the rectangular area, but when it is 10, it is drawn outside the area because it is thick.

    Can you know the entire area to be drawn?

    e3277fb2-d1af-4335-8ec4-73b303f34915-image.png



  • line drawing with width greater than one should average the line on both sides of the line's formula. (half inside, and half outside). Calculating the space inside the polygon is a math problem left as an exercise for you.


Log in to reply