zoukankan      html  css  js  c++  java
  • Qt 中Enum进行反射来做Enum to QString

    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.

  • 相关阅读:
    struts2类型转换
    struts2拦截器
    计算机系统结构
    struts2标签
    struts2 OGNL表达式
    使用bootstrap
    Struts2-综合项目
    拦截器,课3
    struts2之OGNL
    Struts2框架
  • 原文地址:https://www.cnblogs.com/loning/p/1887125.html
Copyright © 2011-2022 走看看