Important: Please read the 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?


  • 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