「関数」の定義がリファクタリングできません。ただし、テストクラスで使用する必要があります。Qt4.8を使用。次のコードは 1 を返しますが、予想されるのは 2 です。
テストクラスでtypedef enumを使用するには?
#include <QDebug>
#include <QObject>
#include <QMetaEnum>
typedef enum {
READ = 0x30,
AUTH = 0x40,
EJECT = 0x55
}__attribute__ ((packed)) function;
class test : public QObject
{
Q_OBJECT
public:
explicit test(QObject *parent = 0){
qDebug() << "Enums count=" << this->metaObject()->enumeratorCount();
qDebug() << "Functions=" << this->metaObject()->enumerator( this->metaObject()->indexOfEnumerator("function") ).keyCount();
qDebug() << "worked=" << this->metaObject()->enumerator( this->metaObject()->indexOfEnumerator("worked") ).keyCount();
}
Q_ENUMS(function)
enum worked{forexample};
Q_ENUMS(worked)
};