QMetaObject是负责元对象信息的类,每个继承自QObject的类都会有一个QMetaObject对象,QObject对象共用该QMetaObject对象,给类提供远多于c++默认的typeinfo提供的信息。主要内容如下:
1、类信息
类:QMetaClassInfo Q_CLASSINFO //Q_CLASSINFO("author", "Sabrina Schweinsteiger")
QMetaMethod constructor ( int index ) const
int constructorCount () const
QMetaEnum Q_Enum //
QMetaEnum enumerator ( int index ) const
int enumeratorCount () const
int enumeratorOffset () const
QMetaMethod Q_INVOKABLE
QMetaMethod method ( int index ) const
int methodCount () const
int methodOffset () const
QMetaProperty Q_PROPERTY
QMetaProperty property ( int index ) const
int propertyCount () const
int propertyOffset () const
QMetaProperty userProperty () const
xxxOffset()//返回某类信息的第一个index
xxxCount()
//一般用法for(int i=xxxOffset();i<xxxCount();++i); 遍历某种信息
className();//返回类名
superClass();//返回父类QMetaObject
1、类信息
类:QMetaClassInfo Q_CLASSINFO //Q_CLASSINFO("author", "Sabrina Schweinsteiger")
QMetaMethod constructor ( int index ) const
int constructorCount () const
QMetaEnum Q_Enum //
QMetaEnum enumerator ( int index ) const
int enumeratorCount () const
int enumeratorOffset () const
QMetaMethod Q_INVOKABLE
QMetaMethod method ( int index ) const
int methodCount () const
int methodOffset () const
QMetaProperty Q_PROPERTY
QMetaProperty property ( int index ) const
int propertyCount () const
int propertyOffset () const
QMetaProperty userProperty () const
xxxOffset()//返回某类信息的第一个index
xxxCount()
//一般用法for(int i=xxxOffset();i<xxxCount();++i); 遍历某种信息
className();//返回类名
superClass();//返回父类QMetaObject