python - PyQt drops all of signals and slots after using chained invoke like pyObj.setupUi(parent) -


all of singals (for example textchanged in below codes) dropped , printdummy function silented once used dummywidget().setupui(mainwin), working when used dw = dummywidget(); dw.setupui(main). didn't see specific difference in python's syntax. can share comment?

class dummywidget(object):     def setupui(self, parent=none):         assert parent not none         self.parent = parent         parent.resize(480, 320)         self.dummy = qtgui.qlineedit(parent)         # parent.setcentralwidget(self.dummy)         self.dummy.textchanged.connect(self.printdummy)         qtgui.qapplication.processevents()      def printdummy(self):         print "dummy in class"   if __name__ == "__main__":     import sys      def printdummy(*args):         print "dummy"      app = qtgui.qapplication(sys.argv)     # mainwin = mainwindow()     # edit = qtgui.qlineedit()     # edit.textchanged.connect(printdummy)     # mainwin.setcentralwidget(edit)     mainwin = qtgui.qdialog()     # dummywidget().setupui(mainwin)     dw = dummywidget()     dw.setupui(mainwin)     mainwin.show()     # mainwin.open()     sys.exit(app.exec_()) 

if don't keep reference instance of dummywidget garbage collected, hence slot no longer exist.

if dummywidget.setupui(parent) cannot store reference (this line gives return value of setupui none).


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -