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




--
______________________________________
Darryl Wallace: Project Leader
ProSensus Inc.
McMaster Innovation Park
175 Longwood Road South
Hamilton, Ontario, L8P 0A1
Canada (GMT -05:00)
Tel:       1-905-528-9136
Fax:       1-905-546-1372

Web site:  http://www.prosensus.ca/
______________________________________

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to