QPainter pt(this);
QPainterPath path;
QRegion rdg;
rdg = rdg.united(QRect(50,50,300,50));
rdg = rdg.united(QRect(50,100,350,50));
rdg = rdg.united(QRect(0,150,300,50));
rdg = rdg.united(QRect(450,100,100,50));
path.addRegion(rdg);
pt.drawPath(path);
pt.end();
以上绘制代码绘制出的效果如下

现在的情况是需要一个个矩形区域不断叠加,然后最终一次绘制,但是如果是相交矩形则不能绘制重叠部分的线,效果如下,不知道各位有什么好办法没有。

------解决思路----------------------
用某个类之前,不看看Manual么?
QRegion Class
This class is not suitable for constructing shapes for rendering, especially as outlines. Use QPainterPath to create paths and shapes for use with QPainter.