Quote Originally Posted by Corny View Post
I’ve attempted to make a QModelIndex at row 0 column 0 but since there is no parent for that position, it doesn’t quite work. I have also used a null QModelIndex using QModelIndex() as the parent, and that too, does not appear to work.
The null/empty QModelndex represents the root of a tree model
Qt Code:
  1. QVariant rootDisplayRoleData = model->data(QModelIndex(), Qt::DisplayRole);
To copy to clipboard, switch view to plain text mode 

Toplevel nodes therefore have that as their parent
Qt Code:
  1. QModelIndex topLevelRow0Column0 = model->index(0, 0, QModelIndex());
  2. QVariant displayRoleDataRow0Column0 = model->data(topLevelRow0Column0, Qt::DisplayRole);
To copy to clipboard, switch view to plain text mode 

Of course accessing the model's index API directly is rarely necessary, signals carry QModelIndex arguments and delegates also get told which index they are to work on.

Cheers,
_