I have a QListWidget
which displays a list of names using PyQt in Python. How can I get the QListWidgetItem
for a given name?
For example, if I have the following QListWidget
with 4 items, how can I get the item which contains text = dan?
The python equivalent to vahancho's answer:
items = self.listWidgetName.findItems("dan",Qt.MatchExactly)
if len(items) > 0:
for item in items:
print "row number of found item =",self.listWidgetName.row(item)
print "text of found item =",item.text()