PDA

View Full Version : Model of models



moijhd
12th November 2013, 11:27
Hi,

I have a class MyObject and a class MyObjectContainer.
An object container contains a list of MyObject objects.
Each MyObject owns a QStandardItemModel.
The MyObjectContainer owns a QStandardItemModel.

I want to create a tree view where I insert the model of MyObject in the model of MyObjectContainer.

I tried to copy node, to play with invisibleRootNode...I did not success.

Thanks,

anda_skoa
12th November 2013, 12:19
What you will most likely need is a model class derived from QAbstractItemModel that works on a MyObjectContainer.
When it gets requests for the top level, delegate to the MyObjectContainer model. When it gets requests for the second level, find the appropriate MyObject and delegate to its model.

Cheers,
_