[Qt-qml] QML representation of a C++ tree

Simon Gemmell gemmell101 at hotmail.com
Thu Jun 23 06:08:45 CEST 2011


What I have is a data structure which is a tree (C++ land). Everything in the tree is a "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).
I want to represent the full depth of the tree (which is not fixed!) and have yet to come across a way to do that in QML (dynamically). I have seen various posts and blogs about doing it using QML ListViews inside ListViews, but given the dynamic nature of it (I load from XML into my 'model' and then want the generate the graphical representation of it) I don't know how I'd go about creating a list of lists of n depth... 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/20110623/40f36786/attachment.html 


More information about the Qt-qml mailing list