PDA

View Full Version : [SOVLED] Re: openPersistentEditor for column of a view with proxy



BreakBad
26th June 2012, 18:08
PyQt 4.7

I have a QTableView with custom QSortFilterProxyModel and QItemDelegate.

When I set the root index on the table, I'm attempting to loop through all the rows and openPersistentEditor on column 1. The following is crashing the first call of openPersistentEditor. I've tried passing the proxy's sourceModel() index via mapToSource. Any ideas if this is possible or where I'm going wrong?



table_view.setRootIndex(index)
for i in xrange(self.model().rowCount(self.rootIndex())):
index = self.model().createIndex(i,1)
self.openPersistentEditor(index)


Many thanks.

Added after 12 minutes:

Solved



i in xrange(self.model().rowCount(self.rootIndex())):
self.openPersistentEditor(self.model().index(i,1,s elf.rootIndex()))