code: def replaceItemAtIndex(self, newItem, oldItemIndex):
          
          oldItem = self.getItem(oldItemIndex)
          childNumber = oldItem.childNumber()
          parentIndex = oldItemIndex.parent()
          self.deleteItemAtIndex(oldItemIndex)
          insertedIndex = self.insertItem(newItem, position=childNumber, parentIndex=parentIndex)
          return insertedIndex
docs: Removes the item at the itemIndex and insert a new item instead.