def parent(self, index):
if not index.isValid():<EOL><INDENT>return QtCore.QModelIndex()<EOL><DEDENT>childItem = index.internalPointer()<EOL>parentItem = childItem.getParent()<EOL>if parentItem == self.root:<EOL><INDENT>return QtCore.QModelIndex()<EOL><DEDENT>return self.createIndex(parentItem.row(), <NUM_LIT:0>, parentItem)<EOL>
Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned.