December 11, 2010

Morris Morris
Lab Rat
18 posts

What exactly does “Clipping” mean when we talk about painting in Qt?

 

I have been using Qt for a while. The word “clipping” kinda confuse me when I read the source code / documents. I think it might be a stupid question, but it’s a bit hard to understand for non-english-speaking people like me.

Thanks.

4 replies

December 11, 2010

Gerolf Gerolf
Area 51 Engineer
3210 posts

Clipping means, that if you have overlapping windows for example, you only dar what is really visible, and hidden parts are not drawn (as they are overlapped, they might draw ouside the window etc).
In Qt, if you are using the widgets (e.g. under windows) with non native windows, so from the OS part, there is onkly one window and all widgets are painting on it, the widgets have to clip on their borders, so you can’t paint outside your widget (what would otherwise work :-) ).

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

December 11, 2010

Morris Morris
Lab Rat
18 posts

So, if there’s a clip region defined, only the part of the widget which is inside the region, is drawn. Right?
Thank you~ :)

December 11, 2010

Gerolf Gerolf
Area 51 Engineer
3210 posts

Right
And the clip reagion can be as simple rectangle or a complex structure.
On the widget boundaries, the clipping is there automatically.

Clipping ios alos used for redrawing formerly hidden parts of a widget, so you neend’t repaint the whole thing if only a bit more is shown.

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

December 11, 2010

Bradley Bradley
Lab Rat
314 posts

Note that in the QGraphicsView framework, the items are not clipped by default like the widgets are, but you can optionally request that they are clipped.

 Signature 

Nokia Certified Qt Specialist.

 
  ‹‹ [SOLVED] The Animation Framework / How can I dynamically change EndValue during the animation?      Exception Handling, Throwing Exception and Try/Catch blocks ››

You must log in to post a reply. Not a member yet? Register here!