In Qt, I use a QGraphicsScene and add a QGraphicsPathItem to it. I set the item's outline color to blue and set fill color to solid red. Most of the time, it's normal, but when I zoom the item use mouse, occasionally some extra red lines appear. If I do not set the fill color, this problem does not occur, so I guess the problem is caused by setting the fill color. I don't know how to solve the problem.
The code is as follows:
path = QtGui.QPainterPath()
posList = []
with open('d:\\pol_0.csv', 'r') as fp:
f_csv = csv.reader(fp)
for each_row in f_csv:
posList.append(QtCore.QPointF(float(each_row[0]), float(each_row[1])))
pol = QtGui.QPolygonF(posList)
path.addPolygon(pol)
item = QtGui.QGraphicsPathItem(path)
path.setFillRule(QtCore.Qt.WindingFill)
item.setPen(QtGui.QPen(QtGui.QColor(0, 0, 255), 0))
b = QtGui.QBrush(QtCore.Qt.red)
b.setStyle(QtCore.Qt.SolidPattern)
item.setBrush(b)
I couldn't find any information related to this problem, can anyone help me? Thanks!