code: def setExpanded(self, index, expanded):
          
          if index.isValid():
              item = self.getItem(index)
              item.expanded = expanded
docs: Expands the model item specified by the index.
              Overridden from QTreeView to make it persistent (between inspector changes).