How to remove holes / inside parts from a QPainterPath?
-
I have a QPainterPath representing a capital Letter A. i want to add an offset outline to this Path. So i use
painterPath.setFillRule(Qt::WindingFill); QPainterPathStroker stroker; painterPath = stroker.createStroke(painterPath);
and then:
// Add additional inner lines created by QPainterPathStroker - this creates a border at the original glyph painterPath -= originalPainterPath; // Unite with the original area - removes the border at the original glyph painterPath += originalPainterPath;
This so far works pretty good. The red lines are created as a single QPainterPath element.
But now i want tor remove the triangle inside the upper part of the created shape (marked with a green rectangle below):
I took several approaches here - all of them failed more or less.
The main problem seems to be, that all path functions (contains() / intersects()) only check weather something is in the (potentially filled) Path elements. Also setting setFillRule did not solve this.
Basically i want to remove everything which is inside the outline of the original shape - so that would be inside the black area below:
-
I have a QPainterPath representing a capital Letter A. i want to add an offset outline to this Path. So i use
painterPath.setFillRule(Qt::WindingFill); QPainterPathStroker stroker; painterPath = stroker.createStroke(painterPath);
and then:
// Add additional inner lines created by QPainterPathStroker - this creates a border at the original glyph painterPath -= originalPainterPath; // Unite with the original area - removes the border at the original glyph painterPath += originalPainterPath;
This so far works pretty good. The red lines are created as a single QPainterPath element.
But now i want tor remove the triangle inside the upper part of the created shape (marked with a green rectangle below):
I took several approaches here - all of them failed more or less.
The main problem seems to be, that all path functions (contains() / intersects()) only check weather something is in the (potentially filled) Path elements. Also setting setFillRule did not solve this.
Basically i want to remove everything which is inside the outline of the original shape - so that would be inside the black area below:
@stefanwoe can you change its color to white? Then it disappears.
-
@stefanwoe can you change its color to white? Then it disappears.