[Qt-qml] hasChildren attribute for Qml Model?

Stephen Kelly steveire at gmail.com
Mon Apr 19 14:09:17 CEST 2010


warwick.allison at nokia.com wrote:

>> know whether a particular item hasChildren()
> 
> Isn't this count>0? (it would be a little more efficient though if we had
> an isEmpty or hasChildren)

Nope. count is the number of items in a list. What I'm looking for is the 
number of children of a particular item in the list.

The thing is the qml ListView has a QAbstractItemModel in it which is 
actually a tree. 

If you click on an item that has children, another part of the application 
should show the children. There needs to be some visual indication that a 
item in the list has children.

In QTreeView, that's a [+] which you can click to expand.

Steve.

> 
> --
> Warwick




More information about the Qt-qml mailing list