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.
-
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 :-) ). -
So, if there's a clip region defined, only the part of the widget which is inside the region, is drawn. Right?
Thank you~ :) -
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.
-
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.