



























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.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。