Hi

I am trying to create a workable example of a very simple model to use 
with a QTreeView. Here is the underlying hierarchical data:

TreeModel::TreeModel()
{
     TreeStruct treeStruct;

     treeStruct.name = "one";
     treeStruct.leaves << "one/one" << "one/two";
     m_treeData << treeStruct;

     treeStruct.name = "two";
     treeStruct.leaves.clear();
     m_treeData << treeStruct;

     treeStruct.name = "three";
     treeStruct.leaves << "three/one" << "three/two" << "three/three";
     m_treeData << treeStruct;
}

or:
        one
                one/one
                one/two
        two
        three
                three/one
                three/two
                three/three

Can someone tell me what the index() override would be:

QModelIndex TreeModel::index(int row,
                              int column,
                              const QModelIndex &parent) const
{
        // huh?
}

Perhaps that would be enough to allow me to work out the rest. In 
essence I cannot seem to grasp how QModelIndex works.

-- 
Regards
Alex
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to