pyqt如何在qt中实现信号和槽? [英] how pyqt implement signal and slot in qt?

查看:63
本文介绍了pyqt如何在qt中实现信号和槽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

pyqt 由 SIP 创建,SIP 支持信号和槽.

pyqt is created by SIP, and SIP support signal and slot.

qt 使用 moc 创建关于信号和槽函数的 moc 数据.

qt use moc to create a moc data about the signal and slot functions.

和qt通过索引函数名搜索槽.

and qt search slot by index the function name.

我想知道 pyqt 如何存档?

and I want to know how pyqt archive this?

这是更好地理解pyqt的关键问题...

this is a critical question for better understanding pyqt...

推荐答案

从记忆中,我相信 PyQt 最初只使用代理对象来处理信号和槽,这使得任何 Python 可调用都可以用作槽和漂亮的几乎任何要发出的信号.在某些时候,添加了对静态元对象的支持,从而可以使用 Python 编写 Qt Designer 插件.

From memory, I believe that PyQt initially used only proxy objects to handle signals and slots, making it possible for any Python callable to be used as a slot and pretty much any signal to be emitted. At some point, support for static meta-objects was added, making it possible for Python to be used to write Qt Designer plugins.

我认为某些特定于 Qt 的处理代码在某个时候从 SIP 移到了 PyQt,并且随着时间的推移进行了一些重构,所以我认为值得一开始研究 PyQt 的内部结构.

I think that some Qt-specific handling code was moved from SIP into PyQt at some point, and some refactoring has taken place over time, so I think it's worth looking at PyQt's internals to start with.

这篇关于pyqt如何在qt中实现信号和槽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆