0

I want to use QTreeView to visualize my class hierarchy. That hierarchy is given and I couldn't change it. But QAbstractItemModel force me to implement a parent() method in it. How can I do that?

So I have:

class ItemA
{
  std::vector<Items1> items1;
  std::vector<Items2> items2;
  std::vector<Items3> items3;
};

class Items2
{
  std::vector<Items1X> items1X;
  std::vector<Items2X> items2X;
  std::vector<Items3X> items3X;
};

...

How can I implement a QModelIndex parent(const QModelIndex &index) const; method for QAbstractItemModel?

4

0 に答える 0