[PyQt] Model/View trouble

Никитин Артем nikitin at komset.ru
Fri Sep 28 06:15:24 BST 2007


Hello,

I have trouble with Model/View in PyQt 4.3.0-b1
(PyQt-Py2.5-gpl-4.3.0-b1.exe). My program using model inherit
by QtCore.QAbstractTableModel and view inherit by QtGui.QTableView.
In model I reimplement method data, like this:

def data(self, index, role = Qt.DisplayRole):
  if not index.isValid():
    return QtCore.QVariant()
  col = index.column()
  row = index.row()
  ....

In runtime I got unexpected exception, when trying to scroll data in
view or change view column width.

Traceback (most recent call last):
  File "D:\work\source\branch-2007-08-28\lib\py\kutil\gui\qtw\TableView.py", line 261, in data
    if not index.isValid():
RuntimeError: underlying C/C++ object has been deleted

How is it possible?

-- 
Best regards,
Artem Nikitin



More information about the PyQt mailing list