I'm still having a great deal of difficulty understanding QAbstractItemModel's representation of items. There are two methods that return QModelIndex items that just aren't making any sense to me.
QModelIndex QAbstractItemModel::index(int row, int column, const QModelIndex& index)
is the first. What is the view passing to this function? I index the specific tree item to have an index created for? If so, what's the point of the function? Why not just return index? What do row and column represent? Is index actually a parent node, with the function returning the specific index based on the number of rows beneath that parent? Is column just a no-op here?
When the passed row parameter is used, if ever, does row 0 refer to the index/parent node itself, or the first item below it?
Second,
QModelIndex QAbstractItemModel::parent(const QModelIndex& index) const
It seems like this method would return the direct parent of the passed index. I'm working with a data structure which is inherently tree-like, but stored in a flat array, with array elements containing information on tree depth, so a direct parent would always have a parent with depth 1 less than it's own depth. But what gets fed to createIndex in this case? What do the internal QModelIndex row, column, and internalPointer refer to? Given the array-based structure I'm using, what should the parent of array[0] be?
I've read over the Qt examples and documentation on these topics already, and can't seem to make any progress understanding how these classes work.