def list_items(widget: QListWidget, returnRow: bool = False) -> Tuple[int, QListWidgetItem]: """A generator to get items from list widget.""" for row in range(widget.count()): if returnRow: yield row, widget.item(row) else: yield widget.item(row)
def list_texts( widget: QListWidget, return_row: bool = False) -> Iterator[Union[Tuple[int, str], str]]: """Generator to get the text from list widget.""" for row in range(widget.count()): if return_row: yield row, widget.item(row).text() else: yield widget.item(row).text()
def list_texts(widget: QListWidget) -> Iterator[str]: """Generator to get the text from list widget.""" for row in range(widget.count()): yield widget.item(row).text()