示例#1
0
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)
示例#2
0
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()
示例#3
0
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()