[Qt-interest] Clipping a polyline

R. Reucher rene.reucher at batcom-it.net
Mon Sep 14 11:49:55 CEST 2009


On Mon, 14 Sep 2009 09:36:35 +0000, R. Reucher wrote:

> On Mon, 14 Sep 2009 10:03:30 +0100, Jeremy Sanders wrote:
>> Hi - I'd like to clip a polyline before painting it on a paint device.
>> I only need to clip with a rectangle. Is there any function in Qt for
>> doing this? It looks like QPainterPath::intersected would clip polygons
>> to other regions, but I can't see a way of clipping polylines.
> What do you mean by "polylines" _exactly_? If it's just a set of points,
> couldn't you clip an implicitly closed QPolygon (created with your set
> of points) and use all but the last point of it to create/draw the
> (clipped) polyline?
Oh, I have to correct myself again (and I hate that :). Of course, this 
will not work at all... but you should be able to gather the relevant 
points by clipping a QPolygon created from your set of points.

Someone may come up with an easier way.
-- 
René Reucher
rene.reucher at batcom-it.net
http://www.batcom-it.net/



More information about the Qt-interest-old mailing list