pan*_*ish 13
python相当于vahancho的答案:
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()
Run Code Online (Sandbox Code Playgroud)
你可以使用QListWidget::findItems()功能.例如:
QList<QListWidgetItem *> items = listWidget->findItems("dan", Qt::MatchExactly);
if (items.size() > 0) {
// An item found
}
Run Code Online (Sandbox Code Playgroud)