phosse1
21st December 2010, 19:00
Hi all,
I have a function which add a 2d array to a table. When I execute this function, a RuntimeError exception is thrown. Below is my code sample. I would be very thankful for any advice/assistance regarding this matter:
def array_2_table(self, array, qtable):
qtable.setColumnCount(10) #rows and columns of table
qtable.setRowCount(600)
for row in range(600): # add items from array to QTableWidget
for column in range(10):
item = array[row][column] # each item is a QTableWidgetItem
# add the QTableWidgetItem to QTableWidget, but exception thrown
qtable.setItem(row, column, QTableWidgetItem(item))
The exact exception is: RuntimeError: underlying C/C++ object has been deleted
I would be very thankful if anyone could provide insight into this error or how one can add fixed-size 2D array to a QTableWidget.
Thanks in advance,
p.
I have a function which add a 2d array to a table. When I execute this function, a RuntimeError exception is thrown. Below is my code sample. I would be very thankful for any advice/assistance regarding this matter:
def array_2_table(self, array, qtable):
qtable.setColumnCount(10) #rows and columns of table
qtable.setRowCount(600)
for row in range(600): # add items from array to QTableWidget
for column in range(10):
item = array[row][column] # each item is a QTableWidgetItem
# add the QTableWidgetItem to QTableWidget, but exception thrown
qtable.setItem(row, column, QTableWidgetItem(item))
The exact exception is: RuntimeError: underlying C/C++ object has been deleted
I would be very thankful if anyone could provide insight into this error or how one can add fixed-size 2D array to a QTableWidget.
Thanks in advance,
p.