python - QListWidget: connect function when QListWidgetItem changed -


i have qlistwidget qlistwidgetitems carry checkboxes .i want call function when either checkbox checked/unchecked or new qlistwidgetitem added.

to try call qabstractitemmodel of qlistwidget self.flist implement datachanged signal. program crashes on following line:

self.flist.model().datachanged.connect(self.plot_paths) 

here relevant code. hope can me connect plot_paths function event of qlistwidgetitems changes.

self.flist = qtgui.qlistwidget() self.file_list.addwidget(self.flist, 1, 0, 1, 3) self.flist.model().datachanged.connect(self.plot_paths)  def plot_paths(self, topleft, bottomright):      model = self.flist.model()     index in range(model.rowcount()):         item = self.flist.item(index)         if item.checkstate() == qtcore.qt.unchecked:             self.on_adjust() 


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -