[PyQt] tableItem as a list

Behnam Kamrani bkamrani at gmail.com
Wed May 2 01:30:46 BST 2007


Hi,
I'm writing this message desperately. Using qt (3.3.4), I have a table in a
widget, and since it needed to Enabled/Disabled table cells, I used
tableItems for it.

To make it structural in my thinking, I used a list like
self.myTable.tableItem = [ [ ] ]. This way, it became possible to save all
tableItems in a list and reuse it. ie:

for iRow in range(0, numberOfRows):
self.myTable.tableItem.append( myTableItemClass)
    for iCol in range(0, numberOfCols):
     self.myTable.tableItem[iRow].append( myTableItemClass)
...
...

But the problem arises when I redraw the table for several times (e.g. 16
times). The GUI does NOT crash, however in output windows I get the
following messages :

QGVector::remove: Index -7 out of range
QGVector::remove: Index -7 out of range
QGVector::remove: Index -7 out of range
---  as the number of tableItems in the list ----

I tried to empty out the list each time the table is redrawed without any
success. Some attempts for example:
self.myTable.tableItem = [ [ ] ]
or
del self.myTable.tableItem[ :]
or
del self.myTable.tableItem
or
del self.myTable.tableItem[ 0: 6]  (since myTable has 6 columns)

Any help is greatly appreciated!

Thanks in advance,
/Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070502/6b4b8418/attachment.html


More information about the PyQt mailing list