[Qt-qml] hasChildren attribute for Qml Model?
Stephen Kelly
steveire at gmail.com
Fri Apr 9 16:30:26 CEST 2010
Hi,
In my qml interface I have a QAbstractItemModel in a ListView and need to
know whether a particular item hasChildren(), so that when it is clicked, I
can change the contents of the view to show its children.
Currently I've hacked it with a custom role and return hasChildren(index) in
my data() method in my base model, but this doesn't work through proxy
models if they filter out all children (common in my case).
Better would be for QDeclarativeModel or whatever it's called to call
hasChildren on the model so that I can do something like this in QML in my
delegate:
Rectangle {
id : hasChildrenIndicator
opacity : model.hasChildren ? 1 : 0
}
Can that be added?
All the best,
Steve.
More information about the Qt-qml
mailing list