Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何从QStandardItemModel充满QStandardItem项目并显示QListView在pyqt. 我做了QStandardItemModel如下所示的类似代码:
QStandardItemModel
QStandardItem
QListView
pyqt
item = QtGui.QStandardItem("something") QStandardItemModel.appendRow(item)
您首先需要找到具有匹配文本的项目,然后将它们从模型中删除:
model = listview.model() for item in model.findItems('something'): model.removeRow(item.row())
我相信给出的解决方案仅在 findItems 返回单个项目时才有效。否则第一次调用 removeRow 将使下一个项目无效......