2

In Qt you can set a clipping region for a QPainter with modes ReplaceClip or IntesectClip but I miss an "ExcludeClip". How would you draw (filling) a "donut" (a circle with a transparent hole) without reverting to intermediate QPixmaps?

tru7
  • 6,348
  • 5
  • 35
  • 59

1 Answers1

3

Found a solution operating with regions:

QRegion rg1(outerRect,QRegion::Ellipse);
QRegion rg2(innerRect,QRegion::Ellipse);
QRegion rg3=rg1.subtracted(rg2);

painter->setClipRegion(rg3);
tru7
  • 6,348
  • 5
  • 35
  • 59