惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
Hugging Face - Blog
Hugging Face - Blog
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
B
Blog
小众软件
小众软件
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
I
InfoQ
Engineering at Meta
Engineering at Meta
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
H
Help Net Security
雷峰网
雷峰网
S
SegmentFault 最新的问题
V
Visual Studio Blog
爱范儿
爱范儿

博客园 - Loning

性能对比:aelf智能合约运行环境性能是evm的1000倍 aelf帮助C#工程师10分钟零门槛搭建DAPP&私有链开发环境 手机跨平台方案介绍 pInvokeStackImbalance MDA 异常解决方法 天津大学免费上网,IPV4及IPV6同时共享的解决方案 纪念那个死去的ASP.NET CMS系统,附死了的源码 基于事件通信的轻量级MVP框架实现,附源码 Git初始化的相关问题 解决mysql表已满的错误 Publish 提示与目标版本不同 C++关闭在debug模式下的“Microsoft Visual C++ Debug Library”对话框 我的OO实践---由GPS消息处理抽象出一通用命令处理类 敏捷开发读书笔记 谈谈我处理异常的一般方法 微软学生技术俱乐部夏令营的一些感受 N95当手柄玩游戏,甩起来还可以用手势控制电脑,分享一下我们的设计经验 这个回答真逗- - 收到开Windows 7 party的资源了【无图无真相】 初探MS SQL CE+Codesmith
Qt 中Enum进行反射来做Enum to QString
Loning · 2010-11-24 · via 博客园 - Loning

2010-11-24 22:37  Loning  阅读(1437)  评论()    收藏  举报

i assume you want to retrieve a QMetaEnum for a particular enum which is registered with Q_ENUMS.

let {class} denote the QObject-derived class which contains the enum, and let {enumName} denote the name of the enum. the following code gets you the enum's QMetaEnum:

QMetaObject metaObject = {class}.staticMetaObject;
QMetaEnum metaEnum = metaObject.enumerator( metaObject.indexOfEnumerator( {enumName} ) );

this compiles despite the fact that neither QMetaObject nor QMetaEnum define operator=(). i'm not sure why--they must be defined somewhere else, but i can't find them.