'Restore all items expanded state'

def restore_expanded_state(self):

    if (self.__expanded_state is None):
        return
    for item in (self.get_items() + self.get_top_level_items()):
        user_text = get_item_user_text(item)
        is_expanded = self.__expanded_state.get(hash(user_text))
        if (is_expanded is not None):
            item.setExpanded(is_expanded)
