pyqt如何在qt中实现信号和槽?
pyqt是由SIP创建的,SIP支持信号和槽。
qt 使用 moc 创建有关信号和槽函数的 moc 数据。
qt 通过索引函数名称来搜索槽。
我想知道 pyqt 如何存档这个?
这是更好地理解 pyqt 的关键问题......
pyqt is created by SIP, and SIP support signal and slot.
qt use moc to create a moc data about the signal and slot functions.
and qt search slot by index the function name.
and I want to know how pyqt archive this?
this is a critical question for better understanding pyqt...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据记忆,我相信 PyQt 最初仅使用代理对象来处理信号和槽,使得任何 Python 可调用对象都可以用作槽,并且几乎可以发出任何信号。在某些时候,添加了对静态元对象的支持,使得 Python 可以用于编写 Qt Designer 插件。
我认为一些特定于 Qt 的处理代码在某个时候从 SIP 转移到了 PyQt,并且随着时间的推移已经发生了一些重构,所以我认为值得首先看看 PyQt 的内部结构。
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.
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.