pyqt4 Table Widget deleting c/c++ object

Andrew andrewt.herd at
Mon Oct 18 23:26:25 CEST 2010

I have two issues dealing with the table widget, though they may be
interconnected. I'm not sure. Both delete the cell widgets off of my
table but leave the rows, and then when I have the table update, it
complains the c++ object has been deleted.

# self.tableData.setCellWidget(rowCount, 0, trackItem)
# RuntimeError: underlying C/C++ object has been deleted

I have a list of a custom widget class that keeps track of several
directories. Each class gets put into a row on the table. I have a set
of radio buttons that will show me different views of the data: All,
New, Done, Errors, Warnings.
When I switch views, I clear my table, set the row count to 0, and
then add back in only the widgets I want to see.

Error 1:
I load in the data initially, and then repopulate the table, and then
re-size the window, instantly all listed rows are cleared, but the
rows stay. This only happened on the diagonal re-size (bottom left
corner); not the up and down, or side to side re-size. Attempting to
repopulate the table, resulted in: underlying C/C++ object has been
deleted. Though it will put in the correct number of rows required.

Everything worked fine as long as I did not re-size the window.

Error 2:
I load in the data initially, and then repopulate the table, the table
clears and then nothing happens. No error messages or even visible
rows. After several more repopulates it with either crash or tell me:
underlying C/C++ object has been deleted.

I had error 1 two days ago, then without changing the code, I now get
error 2. I do not have to re-size the window for it to break now.

I am using python 2.7 with PyQt4 4.7.7

Thanks for any insight,

More information about the Python-list mailing list