[PyQt] [QListView] endless data() calls

c.buhtz at posteo.jp c.buhtz at posteo.jp
Thu Dec 24 11:45:26 GMT 2015


I am using QListView and a QListModel with it. There is a list of
strings in it.

For debuging I do print out the row/column on each data() call. And I
can see there that the calls start again when the end is reached.
Again and again...
And nothing is displayed in the view itself.


     def data(self, idx, role):
         if idx.isValid():
             if role == Qt.DisplayRole:
                 print('data row: {} column: {}'
		       .format(idx.row(), idx.column()),
		       end='\r')
                 return self.model[idx.row()]
         return QVariant()

Any ideas what could cause someting like that?

I tweaked a little bit around. It doesn't depend on the length of the
list I think. A 40000 and 1000 list doesn't work. A 4000 list works.
-- 
GnuPGP-Key ID 0751A8EC


More information about the PyQt mailing list