I have a problem with QPainterPath
because when I do this:
QPainterPath path(start);
path.quadTo(control, end);
QPainter painter;
painter.setBrush(Qt::black);
painter.drawPath(path);
it draws the area beneath the curve black as well. Using QPainterPath::closeSubpath()
nor QPainterPath::moveTo(start)
helps. The only thing that does help is drawing the curve back to beginning which is silly and with antialiasing on looks bad.
But this is not just a visual issue. I use the same code for QGraphicsItem::shape() and it actually causes the item's shape to include the area beneath the curve which is undesirable.
Current (with above code)
Desired (produced with QPainerPath::quadTo(control, start)
)
Notice the bad edges of the desired curve due to QPainter
drawing it twice - once from each direction.
What am I doing wrong here?