[Qt-interest] QRegion with rounded rect

Andre Haupt andre at bitwigglers.org
Thu Jun 11 04:37:03 CEST 2009


On Thu, Jun 11, 2009 at 09:20:18AM +0200, Samuel Rødal wrote:
> Andre Haupt wrote:
>> Hi Samuel,
>>
[snip]
>> In the meanwhile i found a solution that works for me, but i am not sure
>> that my approach is "the right thing (tm)" to achieve such a glass effect.
>>
>> Should i use QPainterPath instead to construct the shape and then do a QPainter::fillPath()?
>>
>> regards,
>>
>> Andre
>
> Yep, I would use QPainter::fillPath() for that. Potentially since you  
> have two shapes that you want to combine (the rounded rect and the  
> ellipse) you might consider using clip for one of them and  
> QPainter::fillPath() for the other. However, if in this case one of the  
> shape is fully contained in the other you might add them both to the  
> same path, thus utilizing the Qt::OddEvenFill fill rule to mask out the  
> inner ellipse. If possible, this should be the most optimal way.
The ellipse is not fully contained in the rounded rect.

Thank you very much, Samuel

Regards,

Andre



More information about the Qt-interest-old mailing list