'Removes all items from the legend'

def clear(self):

    for lst in self.items.values():
        for i in lst:
            i.setParentItem(None)
            if self.scene():
                self.scene().removeItem(i)
    self.items = {}
    self.update_items()
