pyqt signal and slot are not applicable in this case only



  • when i clicking on btn_acc, acceptt signal in LoginForm is emited but in MainForm class mainform_show slot not run(I think, however, do not understand where the problem is?)

    class LoginForm(QDialog,login.Ui_Dialog):
        acceptt = pyqtSignal(list)
        def __init__(self,parent=None):
            super(LoginForm,self).__init__(parent)
            self.setupUi(self)  
            self.connect(self.btn_acc,SIGNAL("clicked()"),self.authentication)
    
    
        def authentication(self):
            self.acceptt.emit(['masood',41])
            # print(['masood',41])
            self.close()
    
    class MainForm(QMainWindow,Ui_MainWindow):    
        def __init__(self,parent=None):
            super(MainForm,self).__init__(parent)
            self.setupUi(self)
            self.username = None
            self.user_id = None
            self.logine_form = LoginForm(parent=self)
            self.logine_form.acceptt.connect(self.mainform_show)
            self.login()
    
        @pyqtSlot()
        def mainform_show(self,bn):
            self.username = bn[0]
            self.user_id = bn[1]
            print(self.username)
        def login(self):
            self.logine_form.exec_()
    

    thank you



  • This post is deleted!

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.