public override QModelIndex Parent(QModelIndex index) { if (!index.IsValid()) { return(new QModelIndex()); } TreeItem childItem = (TreeItem)index.InternalPointer(); TreeItem parentItem = childItem.Parent(); if (parentItem == rootItem) { return(new QModelIndex()); } return(CreateIndex(parentItem.Row(), 0, parentItem)); }