zoukankan      html  css  js  c++  java
  • pyqt中自定义信号

    pyqtSignal的使用

    --自定义信号,有两种方法,第一种是直接定义一个pkey_press = pyqtSignal(str, str)
    然后在已经连接的槽函数中进行传递
    例如:
    `

    def register_btn(self):

        print('弹出注册界面!')
    
        self.out_register_signal.emit()`
    

    这是在系统自带的信号中进行传递信号

    第二种是因为系统自带的型号无法传递指定参数,所以需要自定义信号

    注意:设置自定义信号的类,比如需要在button按钮中自定义信号,那么就要注意,如果自己使用了类的继承,比如:

    `

    class CalculatorBtn(QPushButton):

    key_press = pyqtSignal(str, str)`
    

    已经将QPushuButton重新定义了,那么就需要将信号函数放到重写的函数中
    --然后注意,该信号所要使用的槽函数不能写在这个继承的类中,至于为什么现在还不清楚。

  • 相关阅读:
    topcoder srm 445 div1
    topcoder srm 440 div1
    topcoder srm 435 div1
    topcoder srm 430 div1
    topcoder srm 400 div1
    topcoder srm 380 div1
    topcoder srm 370 div1
    topcoder srm 425 div1
    WKWebView强大的新特性
    Runtime那些事
  • 原文地址:https://www.cnblogs.com/ch2020/p/14619143.html
Copyright © 2011-2022 走看看