[PyQt] QModelIndex.internalPointer Bug

Phil Thompson phil at riverbankcomputing.com
Tue Jun 6 09:22:14 BST 2017


On 6 Jun 2017, at 1:00 am, Andres Ulloa <andresdulloa at gmail.com> wrote:
> 
> The behavior of the bug is that python crashes when you create an index with a pointer to an instantiated object's attribute, and then try to access that pointer using the internalPointer method.
> 
> Example
> ------------
> class foo:
>     def __init__(self):
>         self.bar = 2
> 
> class TreeModel(QtCore.QAbstractItemModel):
>     def __init__(self, parent=None):
>         super(TreeModel, self).__init__(parent)
>         self.foo = foo()
>         ind = self.createIndex(1,1,self.foo.bar)
>         print ind.internalPointer()
> 
> Any help would be appreciated.

I would need a complete (short) script that demonstrates the problem.

Phil


More information about the PyQt mailing list