Strange behavior of QGraphicsPolygonItem (PyQt4)
Hello,
I use PyQt4 4.8.4
I subclass QGraphicsPolygonItem with, say, MyGraphicsPolygonItem. In that class
each time i move, insert or delete points , in order to visualize result, i have to write :
Code:
poly = self.polygon()
poly
[1]=QPointF(1.0,
2.0)#do my stuff on polyself.setPolygon(poly)
Not very pleasant but... Going a little deeper, i notice this strange behaviour :
Code:
>>> id(gpol.polygon())
4534170912
>>> gpol.polygon()[6]
>>> id(gpol.polygon())
4534170128
...
and so on, id(pol) is very often changing, even when nothing happens to it.
provided id(obj) is supposed to represent memory adress of a Python object, this mean a QGraphicsPolygonItem change in place in memory...????
This does not happen with, for instance, QPointF :
Code:
>>> id(a)
4534171136
>>> a.x()
2.0
>>> id(a)
4534171136
>>> a.setY(33)
>>> id(a)
4534171136
Is this a bug ? or a desired feature ?
Thanks for your answer.