[PySide] Issue with QStandardItemModel, QSortFilterProxyModel and fetchMore

Tony Barbieri greatrgb at gmail.com
Mon Mar 3 17:44:59 CET 2014


I resolved it by not calling beginInsertRows and endInsertRows...perhaps
the appendRow call is already taking care of notifying the proxy and view?
 Seems to have cleared up the issue.

Thanks!

-tony


On Mon, Mar 3, 2014 at 10:40 AM, Tony Barbieri <greatrgb at gmail.com> wrote:

> Hello!
>
> I have a QTreeView which I am populating using a QStandardItemModel.  I
> also have data that needs to only be queried once a certain level of the
> tree is accessed.  I am using the fetchMore method and it appears to work
> great.
>
> Unfortunately once I add in QSortFilterProxyModel, there are extra empty
> items being added to the tree.  I'm not sure where it's coming from or how
> I can avoid it.  Below is the fetchMore method I'm using.  I appreciate any
> thoughts!
>
> def fetchMore(self, index)
>         parent = self.itemFromIndex(index)
>
>         self.beginInsertRows(index, 0, len(sg_data))
>         for item in sg_data:
>             parent.appendRow(item)
>         self.endInsertRows()
>
> --
> -tony
>



-- 
-tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140303/722d06de/attachment.html>


More information about the PySide mailing list