code: def set_root(self, index):
          
          if not index.isValid():
              self.setModel(None) # so we will not see toplevel stuff
              self.setCurrentIndex(QtCore.QModelIndex())
              self.new_root.emit(QtCore.QModelIndex())
              return
          if self.model() != index.model():
              self.setModel(index.model())
          self.setRootIndex(index)
          if self.model().hasChildren(index):
              self.setCurrentIndex(self.model().index(0, 0, index))
              self.new_root.emit(self.model().index(0, 0, index))
          else:
              self.new_root.emit(QtCore.QModelIndex())
docs: Set the given index as root index of list
  
          :param index: the new root index
          :type index: QtCore.QModelIndex
          :returns: None
          :rtype: None
          :raises: None