PyQt4 filter by text on a QListView using setRowHidden
问题 I have a dialog which looks like this: That dialog has the following code connected to the filter button: class Dialog(QtGui.QDialog, addWin.Ui_Dialog): ... self.list = QListView() self.filter.clicked.connect(self.filterClicked) ... def filterClicked(self): filter_text = str(self.lineEdit.text()).lower() for row in range(self.model.rowCount()): if filter_text in str(self.model.item(row).text()).lower(): self.list.setRowHidden(row, True) else: self.list.setRowHidden(row, False) However, when I