[Qt-interest] Finding visual region on a widget

Andre Somers andre at familiesomers.nl
Mon Mar 29 13:07:12 CEST 2010


On 29-3-2010 12:26, Sarath wrote:
> Hi,
>
> I am trying to figure out a problem involving the visual region on a widget.
>
> When one widget, W1 is overlapping with another widget W2, how can I
> find the visible region (bounding rect) on widget W2.
> I have tried using QWidget::visibleRegion(), it gives the entire region
> of widget W2 and not the visible region of widget W2.
>
> Can any body help me on this.
>
> Thanks,
> Sarath
>
>    

You'll need to use a QRegion. I assume W1 overlaps (is partly on top of) 
W2.
First, initialize your QRegion with the rect of W2, then substract the 
rect of W1, both in the same coordinate system of course.
The result will be the region that is visible of W2.

André



More information about the Qt-interest-old mailing list