Priority: Not Evaluated
Affects Version/s: None
Fix Version/s: None
Sometimes we want to walk through the elements of a list in order to do some kind of operation. As a python developer I expect to have a list that behave like a list or, at the very least, provides an interface to easily iterate over the list's items.
The current way to do so is:
A better and less cumbersome way to have access to the list item's would be:
Having a QListWidget behave like an iterator, or have a method return an iterator (ListWidget.iterate()), will allow developers to make full use of python's generator expressions and list comprehensions. It could be used to easily filter or sort a list.
And if a QListWidget would support being fed from a list of QListWidgetItem (NewList), the possibilities would be endless!
While this suggestion limits itself to QListWidget, other Qt elements would surely benefits from being iterable. For instance, it would probably be very interesting to be able to iterate over a table's columns or rows. Or simply iterate over the children that a layout contains. It may not be wise to iterate over everything, so asking the QWidget to return an iterator based on specified parameters could be a better idea.
To iter over all children whose name ends with "_input" and is not enabled:
I may be missing something obvious, or an alternative and equally easy way to do what I proposed. Feel free to educate me