Hi,

Consider the following two structures, where "Contact" is the main structure which has list of "Address" objects as one among its data member.

struct Address
{
QString pincode;
QList<QString> telephone;
};

struct Contact
{
QString firstName;
QString secondName;
QString address;
QList<Address*> addressList;
};

I created a QTreeView which inherits from QAbstractItemModel. Each QTreeViewItem parent should be mapped to "Contact" data members where the "addressList" should be mapped as a child item for that particular parent. I am trying to write a user defined function logic to parse the structure members and add as a Parent/child accordingly.

My use case is that , when i click the child row (addressList), i need to retreive the entire Address object but not the Contact object. How can i achieve this using ModelIndex?

TIA