1.往QListView控件內寫入數據
strlist=QStringList()
strlist.append('hello')
strm=QStringListModel(strlist)
self.ui.listView.setModel(strm)
2.QListView加入複選框
self.model = QStandardItemModel(self.ui.listView)
item = QStandardItem(food)
# Add a checkbox to it
item.setCheckable(True)
# Add the item to the model
self.model.appendRow(item)