python - Updating cell widgets changes in a Qtable without selecting the cell -


well i'm using pyqt4 in maya2012 make reference editor alike ui. working qtablewidget make reference list , have subwidgets in each cell. 1 of widgets checkbox unload or reload reference. problem have if click directly in checkbox without have cell selected doesn't anything

this code:

 def listconnections(self):      self.pos=self.sender().currentrow()      wid = self.list.ref_l.cellwidget(self.pos, 0).children()      self.text = self.list.list[self.pos]     self.ref()      wt in wid:         if type(wt)== type(qcheckbox()):             wt.statechanged.connect(self.changestate)          if type(wt)== type(qcombobox()):             wt.currentindexchanged.connect(self.changetype) 

i'm calling function "itemslectionchanged" signal because way knew detect subwidgets. subwidgets made in moment fill list.

is there way make want?

edit:

this how called function

self.list.ref_l.itemselectionchanged.connect(self.listconnections) 

and how create subwidgets in cells

 def filllist(self):     mayaref = self.findref()      if len(mayaref)>0:         count in range(0,len(mayaref)):              self.ref_l.insertrow(count)              wid=qwidget()             clayout=qhboxlayout()             wid.setlayout(clayout)              checkwid=qcheckbox()              namewid=qlabel()              clayout.addwidget(namewid)              namewid2=qlabel()              clayout.addwidget(namewid2)              comwid=qcombobox()             clayout.addwidget(comwid)              self.ref_l.setcellwidget(count,0,wid) 

self.ref_l qtable widget, in code i'm calling self.list in original

you should set connections right after create check boxes in filllist. each item associated path of reference. can use qsignalmapper map each check box path, connect signal mapper changestate slot. signal mapper calls slot path specified.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -