Andreas Pakulat wrote:

> The reason you get a segfault when using a proxy is quite simply that
> you're trying to access something which doesn't exist. The index you get
> in cellClicked is not an index of your custom model, its an index of the
> proxy model, which doesn't have an internal pointer (or maybe it does,
> but its not what you expect). Whenever you get an index from a view or
> selection model and you're using proxy models, you first have to convert
> from the proxy index into a source index via mapTosource() from
> QAbstractProxyModel.

Ok, it works perfectly. Just replace the cellClicked function by:

    def cellClicked( self, qmodelindex ):

        if qmodelindex.isValid():
            qmodelindex = self.proxyModel.mapToSource( qmodelindex )
            print qmodelindex.internalPointer()

-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to