Hello,
I need to draw polygon with holes, the holes are also polygons, how do to build a graphics item like this in qt4?
I am thinking to construct it with QPainterPath, but I am not sure how to do it.
Any ideas?
Hello,
I need to draw polygon with holes, the holes are also polygons, how do to build a graphics item like this in qt4?
I am thinking to construct it with QPainterPath, but I am not sure how to do it.
Any ideas?
Hi,
not sure if this is the best solution, but I am doing something like this:
Qt Code:
QPainterPath path; QPolygonF p; //add outer points path.addPolygon(p); QPainterPath inner; //add inner points inner.addPolygon(p); path = path.subtracted(inner);To copy to clipboard, switch view to plain text mode
Hi, It seemed to me that this version is faster:
Qt Code:
QPainterPath path; QPainterPath sub; paint.setClipRegion(clip); paint.fillPath(path,brush);To copy to clipboard, switch view to plain text mode
Thanks for these suggestions.
I will try them tomorrow and get back to here. I am just too drunk now.
Need to get some sleep
Hi,
I think I will use the first method right now. If I need to write a customized graphics item, the second one may be a good choice.
BTW: is there any particular reason that the second method is faster than first one?
Thanks for help!
Bookmarks