[Qt-qml] Model Based Trees in QML?
Simon Gemmell
gemmell101 at hotmail.com
Fri Dec 30 03:27:59 CET 2011
Hello,
I'm wondering how I could go about implementing a view of a C++ based tree such that the entire tree is shown. I've seen plenty where you can navigate the tree showing sections of it, but i want to see the WHOLE tree.
The complication is that I have a data structure in C++ land, and everything in the tree is an abstract "TreeNode" but there are 5 or 6 specialisations of TreeNode that represent different things. The tree is not a part of any of the Qt model frameworks (e.g. AbstractItemModel etc). Can QML handle recursive tree structures like that yet (each TreeNode has a list of child TreeNode's)? Is there some magical way to say "here is my tree of TreeNodes" and QML then knows how to layout and draw each concrete instance (e.g. TextTreeNode, ImageTreeNode etc)?
Can anyone point me in the right direction? I don't actually intend on drawing my tree like a QTreeView, it actually represents a document, but I am stuck on the first step of getting a C++ tree structure mapped to something in QML.
Any pointers you could provide would be of great help.
Thanks,Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20111230/d49079e5/attachment.html
More information about the Qt-qml
mailing list