PDA

View Full Version : drawLine without qrect



stevocz
2nd October 2014, 14:12
hi.

Is some function for drawLine in painter, but without drawing line in some QRect?

example:

i can drawLine from 0,5 to 10,5, but I have rect (5,2,2,5) which is transparent and in this rect i don't want this line

ChrisW67
2nd October 2014, 22:03
Call QPainter::setClipPath() with a QRegion that excludes the rectangle you do not want to draw inside. You can build the region by starting with one that covers the entire screen and then subtracting one that covers the rectangle.

stevocz
3rd October 2014, 08:16
thanks and is possible set ends of Line was clipped on nearest point of edge of rect?

wysota
11th October 2014, 09:47
Clipping is defined by the clipping region so the line will be clipped to whatever region you set.