def add_set(self, iterable, title=None): """ Adding the given iterable to the list with a first Separator object with given title :param iterable: list of item's attributes :param title: Separator's name """ if len(iterable): # if title is given we first add a Separator item to indicate coming list title if title: self.WL_attributes.addTopLevelItem(QTreeWidget_Separator(title)) items = [] for attr in sorted(iterable): item = QTreeWidgetItem([attr]) # assigning the attribute itself inside a custom parameter item.attribute = attr items.append(item) # finally adding all the items to the list self.WL_attributes.addTopLevelItems(items)
def add_set(self, iterable, title=None): """ Adding the given iterable to the list with a first Separator object with given title :param iterable: list of item's attributes :param title: Separator's name """ if len(iterable): # if title is given we first add a Separator item to indicate coming list title if title: self.WL_attributes.addTopLevelItem( QTreeWidget_Separator(title)) items = [] for attr in sorted(iterable): item = QTreeWidgetItem([attr]) # assigning the attribute itself inside a custom parameter item.attribute = attr items.append(item) # finally adding all the items to the list self.WL_attributes.addTopLevelItems(items)