返回介绍

QMetaObject Class

发布于 2019-10-04 15:01:36 字数 5970 浏览 1414 评论 0 收藏 0

The QMetaObject class contains meta information about Qt objects. More...

#include <qmetaobject.h>

List of all member functions.

Public Members

  • const char * className () const
  • const char * superClassName () const
  • QMetaObject * superClass () const
  • bool inherits ( constchar*clname ) const
  • int numSlots ( boolsuper = FALSE ) const
  • int numSignals ( boolsuper = FALSE ) const
  • QStrList slotNames ( boolsuper = FALSE ) const
  • QStrList signalNames ( boolsuper = FALSE ) const
  • int numClassInfo ( boolsuper = FALSE ) const
  • const QClassInfo * classInfo ( intindex, boolsuper = FALSE ) const
  • const char * classInfo ( constchar*name, boolsuper = FALSE ) const
  • const QMetaProperty * property ( intindex, boolsuper = FALSE ) const
  • int findProperty ( constchar*name, boolsuper = FALSE ) const
  • QStrList propertyNames ( boolsuper = FALSE ) const
  • int numProperties ( boolsuper = FALSE ) const

Detailed Description

The QMetaObject class contains meta information about Qt objects.

The Meta Object System in Qt is responsible for the signals and slots inter-object communication mechanism, runtime type information and the property system. All meta information in Qt is kept in a single instance of QMetaObject per class.

This class is not normally required for application programming. But if you write meta applications, such as scripting engines or GUI builders, you might find these functions useful:

  • className() to get the name of a class.
  • superClassName() to get the name of the superclass.
  • inherits(), the function called by QObject::inherits().
  • superClass() to access the superclass's meta object.
  • numSlots(), numSignals(), slotNames(), and signalNames() to get information about a class's signals and slots.
  • property() and propertyNames() to obtain information about a class's properties.

Classes may have a list of name-value pairs of class information. The number of pairs is returned by numClassInfo(), and values are returned by classInfo().

See also moc (Meta Object Compiler) and Object Model.


Member Function Documentation

const QClassInfo * QMetaObject::classInfo ( intindex, boolsuper = FALSE ) const

Returns the class information with index index or 0 if no such information exists.

If super is TRUE, inherited class information is included.

const char * QMetaObject::classInfo ( constchar*name, boolsuper = FALSE ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the class information with name name or 0 if no such information exists.

If super is TRUE, inherited class information is included.

const char * QMetaObject::className () const

Returns the class name.

See also QObject::className() and superClassName().

int QMetaObject::findProperty ( constchar*name, boolsuper = FALSE ) const

Returns the index for the property with name name or -1 if no such property exists.

If super is TRUE, inherited properties are included.

See also property() and propertyNames().

bool QMetaObject::inherits ( constchar*clname ) const

Returns TRUE if this class inherits clname within the meta object inheritance chain; otherwise returns FALSE.

(A class is considered to inherit itself.)

int QMetaObject::numClassInfo ( boolsuper = FALSE ) const

Returns the number of items of class information available for this class.

If super is TRUE, inherited class information is included.

int QMetaObject::numProperties ( boolsuper = FALSE ) const

Returns the number of properties for this class.

If super is TRUE, inherited properties are included.

See also propertyNames().

int QMetaObject::numSignals ( boolsuper = FALSE ) const

Returns the number of signals for this class.

If super is TRUE, inherited signals are included.

See also signalNames().

int QMetaObject::numSlots ( boolsuper = FALSE ) const

Returns the number of slots for this class.

If super is TRUE, inherited slots are included.

See also slotNames().

constQMetaProperty* QMetaObject::property ( intindex, boolsuper = FALSE ) const

Returns the property meta data for the property at index index or 0 if no such property exists.

If super is TRUE, inherited properties are included.

See also propertyNames().

QStrList QMetaObject::propertyNames ( boolsuper = FALSE ) const

Returns a list with the names of all this class's properties.

If super is TRUE, inherited properties are included.

See also property().

QStrList QMetaObject::signalNames ( boolsuper = FALSE ) const

Returns a list with the names of all this class's signals.

If super is TRUE, inherited signals are included.

QStrList QMetaObject::slotNames ( boolsuper = FALSE ) const

Returns a list with the names of all this class's slots.

If super is TRUE, inherited slots are included.

See also numSlots().

QMetaObject* QMetaObject::superClass () const

Returns the meta object of the super class or 0 if there is no such object.

const char * QMetaObject::superClassName () const

Returns the class name of the superclass or 0 if there is no superclass in the QObject hierachy.

See also className().

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文