[PyQt] segfault when using a proxy and SIGNAL(
"clicked(QModelIndex)" )
Arnold Krille
arnold at arnoldarts.de
Mon Apr 13 13:11:46 BST 2009
Hi,
On Thursday 09 April 2009 19:35:32 TP wrote:
> 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.
I think there is a very good reason internalPointer has the name it has. It is
a pointer for internal purposes, that is internal for the model so it can map
indexes to the internal data structures. (And yes, that is needed for anything
except simple list or table models.:)
You shouldn't really access it from a view (or from a proxy-model). Actually
the reason for the model-view-pattern is that you don't have to access the
internal structures of the model from the view...
And here is another reason this crashes: Not only don't you know which type
(if any) the object pointed to is, you also don't know whether python knows
about that data type (python doesn't really know about pointers).
Have fun,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090413/49ece8e2/attachment.bin
More information about the PyQt
mailing list