I am using layoutAboutToBeChanged().

Here's what I'm doing. It's PyQt. I have a tree made of TreeItem()s (my node class)

Qt Code:
  1. # in subclass of QAbstractItemModel
  2. def recreateTree(self):
  3. self.emit(QtCore.SIGNAL('layoutAboutToBeChanged()'))
  4. self.root = TreeItem(None)
  5. # omitted code to generate the other nodes and add them to root
  6. self.emit(QtCore.SIGNAL('layoutChanged()'))
To copy to clipboard, switch view to plain text mode 

When I reassign self.root, Python automatically deletes the old tree (or should) since there's no other reference to it.