[PyQt] Fwd: How can i know that there are no rows in QTreeView??

David Boddie david at boddie.org.uk
Sun May 16 02:23:36 BST 2010


On Fri, 14 May 2010 12:59:18 +0530, Jeba raj wrote:

> I'm using QTreeView with QDirModel to list the contents of a directory..
> When a user selects an item(or a row) i'm removing it from the tree view
> using the below method
>
> setRowHidden (self, int, QModelIndex, bool)
>
> How can i know that the tree view is empty or all rows are hidden??
> Rowcount and Columncount doesn't seem to help.. Expecting your answers..

I think you would have to keep track of how many rows you hide, or perhaps
traverse the entire tree and look for non-hidden rows, which would be
expensive.

Alternatively, you could try to create a proxy model, based on
QAbstractProxyModel, but that might turn out to be a challenge in itself.

David


More information about the PyQt mailing list