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.