Ok so I guess it's not technically a 'QVector' since QVector is not
explictly implemented. Regardless, the code used to work in PyQt4.4.2
for QPolygon.
And I solve the problem using .at() instead of the __getitem__ / [] operator
darryl
Darryl Wallace wrote:
Hello,
I may have encountered an error with using QPolygon (or I guess any
QVector<QPoint> / QVector<QPointF>) It doesn't appear to be able to
set the values.
The following code is my test:
----------------
from PyQt4 import Qt
from random import random
f=Qt.QPolygonF(5)
print "Before"
for i in range(5):
print f[i].x(), f[i].y()
print "After"
for i in range(5):
newX=random()
newY=random()
f[i].setX(newX)
f[i].setY(newY)
print newX,newY," / ",f[i].x(),f[i].y()
-------------------
Using PyQt4.4.4, Qt 4.4.0, SIP 4.7.9, Python 2.5.2, Windows
You can see that running the program yields no change. The QVector
documentation for the [] operator states that:
T & QVector::operator[] ( int /i/ )
Returns the item at index position /i/ as a modifiable reference.
/i/ must be a valid index position in the vector (i.e., 0 <= /i/ <
size <cid:[email protected]>()).
See also at <cid:[email protected]>() and value
<cid:[email protected]>().
So I think it should still work. I can verify that the above this
works code works for PyQt4.4.2, Qt 4.4.0, SIP 4.7.7, Python 2.5.2 in
Linux.
Is there a work-around available for the near future?
Thanks
Darryl
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt