PyQt4 中的 Q_ENUMS
我想使用 Qt 的枚举功能。我在 QtCore 模块的文档中看到有一个 Q_ENUMS 宏,但我不知道如何使用他。
I would like to use facilities of enumeration of Qt. I saw in documentation of the module of QtCore there is a macros of Q_ENUMS, but I do not know and information how to use him.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 python(和 PyQt)中,创建枚举的方法如下:
如果您需要更多功能,请提供您想要执行的操作的更多详细信息。
编辑
查看QAbstractSocket.stateChanged的文档 我可以看到它指的是“创建自定义 Qt 类型”。我不知道需要在 PyQt4 中注册元类型,因此使用此信号所需要做的就是将其连接到适当的处理程序:
In python (and PyQt), the way to create an enum is like this:
If you need more functionality than that, please give more details of what you are trying to do.
EDIT
Looking at the documentation for QAbstractSocket.stateChanged I can see it refers to "Creating Custom Qt Types". I am not aware of any need for registering metatypes in PyQt4, so all you need to do to use this signal is connect it to an appropriate handler: