Is there an easy way to make an overlapping area between two polygons transparent? Preferably built-in functions within the Qt widgets/Qt 2D graphics C++ framework. (not QML)
I'm rendering map data extracted from Openstreetmap.org and some advanced relations between ways (line segments) are given as inner and outer ways that form polygons.
For example, a lake can have outer ways that form the polygon, and several inner ways that form islands within the lake.
I am able to correctly build the outer polygons and inner polygons separately, but I struggle to find an easy way to make the area that overlaps with inner polygons transparent.
In the image below, the white areas are separate polygons drawn with white, but instead they should be transparent areas of the lake / blue polygon.
I tried to use QPainterPath for the outer polygons and call
QPainterPath QPainterPath::subtracted(const QPainterPath &inner) const
but the result was a blank screen.
Do I have to create new polygons myself prior to rendering?
Should the QPainterPath solution work and I messed something up?
Is there some magic that can be done using QPen/QBrush to paint overlapping areas transparent?
Any tips on how to approach this is highly appreciated.