PyQt5的QAction多次响应triggered信号的处理方式

版权声明:所有的博客都是个人笔记,交流可以留言。未经允许,谢绝转载。。。 https://blog.csdn.net/qq_35976351/article/details/88909188

在QMainWindow的模式中,有时会出现出现一次点击QAction,但是响应多次triggered信号的情况,这种方式可以借助异常处理进行过滤:

    @QtCore.pyqtSlot()
    def on_yourAction_triggered(self):
        try:
            self.actionPVC.triggered.disconnect()
        except:
            pass

猜你喜欢

转载自blog.csdn.net/qq_35976351/article/details/88909188