返回介绍

QMetaProperty Class

发布于 2019-10-04 15:01:37 字数 4414 浏览 861 评论 0 收藏 0

The QMetaProperty class stores meta data about a property.
More...

#include <qmetaobject.h>

List of all member functions.

Public Members

  • const char * type () const
  • const char * name () const
  • bool writable () const
  • bool isSetType () const
  • bool isEnumType () const
  • QStrList enumKeys () const
  • int keyToValue ( constchar*key ) const
  • const char * valueToKey ( intvalue ) const
  • int keysToValue ( constQStrList&keys ) const
  • QStrList valueToKeys ( intvalue ) const
  • bool designable ( QObject*o ) const
  • bool scriptable ( QObject*o ) const
  • bool stored ( QObject*o ) const
  • bool reset ( QObject*o ) const

Detailed Description

The QMetaProperty class stores meta data about a property.

Property meta data includes type(), name(), and whether a property
is writable(), designable() and stored().

The functions isSetType(), isEnumType() and enumKeys() provide
further information about a property's type. The conversion
functions keyToValue(), valueToKey(), keysToValue() and
valueToKeys() allow conversion between the integer representation
of an enumeration or set value and its literal representation.

Actual property values are set and received through QObject's set
and get functions. See QObject::setProperty() and
QObject::property() for details.

You receive meta property data through an object's meta object.
See QMetaObject::property() and QMetaObject::propertyNames() for
details.

See also Object Model.


Member Function Documentation

bool QMetaProperty::designable ( QObject*o ) const

Returns TRUE if the property is designable for object o;
otherwise returns FALSE.

QStrList QMetaProperty::enumKeys () const

Returns the possible enumeration keys if this property is an
enumeration type (or a set type).

See also isEnumType().

bool QMetaProperty::isEnumType () const

Returns TRUE if the property's type is an enumeration value;
otherwise returns FALSE.

See also isSetType() and enumKeys().

bool QMetaProperty::isSetType () const

Returns TRUE if the property's type is an enumeration value that
is used as set, i.e. if the enumeration values can be OR-ed
together; otherwise returns FALSE. A set type is implicitly also
an enum type.

See also isEnumType() and enumKeys().

int QMetaProperty::keyToValue ( constchar*key ) const

Converts the enumeration key key to its integer value.

For set types, use keysToValue().

See also valueToKey(), isSetType() and keysToValue().

int QMetaProperty::keysToValue ( constQStrList&keys ) const

Converts the list of keys keys to their combined (OR-ed)
integer value.

See also isSetType() and valueToKey().

const char * QMetaProperty::name () const

Returns the name of the property.

bool QMetaProperty::reset ( QObject*o ) const

Tries to reset the property for object o with a reset method.
On success, returns TRUE; otherwise returns FALSE.

Reset methods are optional, usually only a few properties support
them.

bool QMetaProperty::scriptable ( QObject*o ) const

Returns TRUE if the property is scriptable for object o;
otherwise returns FALSE.

bool QMetaProperty::stored ( QObject*o ) const

Returns TRUE if the property shall be stored for object o;
otherwise returns FALSE.

const char * QMetaProperty::type () const

Returns the type of the property.

const char * QMetaProperty::valueToKey ( intvalue ) const

Converts the enumeration value value to its literal key.

For set types, use valueToKeys().

See also isSetType() and valueToKeys().

QStrList QMetaProperty::valueToKeys ( intvalue ) const

Converts the set value value to a list of keys.

See also isSetType() and valueToKey().

bool QMetaProperty::writable () const

Returns TRUE if the property is writable; otherwise returns FALSE.

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

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

发布评论

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