code: def set_root(self, index):
          
          if not index.isValid():
              self.setCurrentIndex(-1)
              return
          if self.model() != index.model():
              self.setModel(index.model())
          self.setRootModelIndex(index)
          if self.model().rowCount(index):
              self.setCurrentIndex(0)
          else:
              self.setCurrentIndex(-1)
docs: Set the given index as root index of the combobox
  
          :param index: the new root index
          :type index: QtCore.QModelIndex
          :returns: None
          :rtype: None
          :raises: None