[PySide] QSortFilterProxyModel and QListView - indexWidget pointer get deleted when filtering

Tommaso Massimi tmassimi at gmail.com
Wed Aug 13 23:24:33 CEST 2014


Hi all,

I'm sorry to split this thread but I can't answer
to the right mail as I was not yet subscribed to this ml
when the mail was sent

> Hi
>
> Thanks for your help guys... I'm still stuck with this bug...
>
> Here is a simplified version of the code:> https://gist.github.com/maty974/66e29df303d1f1825a53 <https://gist.github.com/maty974/66e29df303d1f1825a53>
>
> Instead of using a QLabel to show text I paint the text value in the
> painter of the widget.
>
> But after made thoses changes, I've discover that each CustomItemWidget()
> widget get the "QEvent.Type.DeferredDelete" event after filtering with the
> Proxy model...

I think that the function setIndexWidget is requiring that deletion,
try to modify in this way the function addItem
(I'm not sure about what you want to do, so I can't suggest more):


    def addItem(self, item):
        self.data_model.appendRow(item)
        #proxy_index = self.proxy_model.mapFromSource(item.index())
        #self.setIndexWidget(proxy_index, item.item_widget)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140813/77378b61/attachment.html>


More information about the PySide mailing list