[PyQt] segfault when using a proxy and SIGNAL( "clicked(QModelIndex)" )

TP paratribulations at free.fr
Thu Apr 9 18:35:32 BST 2009

Hi everybody,

Here you will find a small (170 lines) self-contained Python script.


I use a model, and a proxy (that does nothing, but in a more complicated
version, not given here, it works perfectly). The view is a QTreeView.

The problem appears when I connect the SIGNAL( "clicked(QModelIndex)" ) to
some method "cellClicked" in the view, I obtain segfaults.
Difficult for me to find the problem.

Here are the most important lines:

        self.view = QTreeView( parent )
        self.connect( self.view, SIGNAL( "clicked(QModelIndex)" )
                , self.cellClicked )

    def cellClicked( self, qmodelindex ):

        if qmodelindex.isValid():
            print qmodelindex.internalPointer()

The problem seems to be related to qmodelindex, the segfault appears when
taking internalPointer method.

Any idea?

Thanks a lot.


python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\

"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)

More information about the PyQt mailing list