https://bugs.kde.org/show_bug.cgi?id=395192
--- Comment #4 from Jos van den Oever <j...@vandenoever.info> --- The functionality that you want is possible, but quite some work. The Model/View in Qt is based on QAbstractItemModel. The current code creates one QAbstractItemModel for a List or a Tree. Each node in the List or Tree has the same properties. Your binding is for a List with a top level of nodes that have `name` and `novel_list`. Each `novel_list` of type `Source` has a list of items again: `chapter_list`. So your model is a tree but the nodes on each level have a different type. It is a clear and logical model from a data modelling point of view. A logical Rust structure for this would be struct Sources { name: String, novel_list: Vec<Source>, } struct Source { name: title: String, chapter_list: Vec<Novel>, } struct Novel { index: u32, title: String, content: String, } In Qt Model/View each node in a tree has an index and all nodes are basically the same. The delegates that render the nodes also treat all nodes the same. But each property can have a different role. If you want to show this model in a QTreeView or TreeView, you'd specify a different role or column for each property. So the role numbers and column numbers should be unique for the properties in the combination of Sources, Source and Novel. The solution I gave you does that. But it does not look as nice as the structure you want. The current code could be expanded to interpret Sources, Source and Novel as belonging to one Tree. It would be very nice, but hard to implement such an addition to the code generator. The solution I gave is also flawed in that I forgot to add `optional`: "objects": { "Novels": { "type": "Tree", "itemProperties": { "sourcesName": { "type": "QString", "optional": true }, "sourceTitle": { "type": "QString", "optional": true }, "novelIndex": { "type": "quint32", "optional": true }, "novelTitle": { "type": "QString", "optional": true }, "novelContent": { "type": "QString", "optional": true } } } } This limitation in the generator is also present in Qt itself. If you write C++ code with QAbstractItemModel, you'd face the same issue that it expects each node in the tree to be the same. -- You are receiving this mail because: You are watching all bug changes.