PyQt4自定义事件

时间:2022-05-15 13:45:17
listview控件与updateText 相关联
self.listview.updateText.connect(self.viewlist)
 
updateText = QtCore.pyqtSignal(str)
#发送信号

updateText.emit('updated list')
 
def viewlist(self):

print 'view'
if self.refresh==False:

self.model = QStandardItemModel(self.ui.listView)
for food in listviewdata:
item = QStandardItem(food)

item.setCheckable(True)

self.model.appendRow(item)