Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QMetaProperty Class Reference

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

    #include <QMetaProperty>

- List of all members, including inherited members

### Public Functions

- QMetaEnum enumerator () const
- bool isDesignable ( const QObject * object = 0 ) const
- bool isEditable ( const QObject * object = 0 ) const
- bool isEnumType () const
- bool isFlagType () const
- bool isReadable () const
- bool isScriptable ( const QObject * object = 0 ) const
- bool isStored ( const QObject * object = 0 ) const
- bool isValid () const
- bool isWritable () const
- const char * name () const
- QCoreVariant read ( const QObject * object ) const
- bool reset ( QObject * object ) const
- QCoreVariant::Type type () const
- const char * typeName () const
- bool write ( QObject * object, const QCoreVariant & value ) const

## Detailed Description

The QMetaProperty class provides meta data about a property.

A property has a name() and a type(), as well as various attributes that specify its behavior: isReadable(), isWritable(), isDesignable(), isScriptable(), isStored(), and isEditable().

If the property is an enumeration, isEnumType() returns true; if the property is an enumeration that is also a flag (i.e. its values can be combined using the OR operator), isEnumType() and isFlagType() both return true. The enumerator for these types is available from enumerator().

The property's values are set and retrieved with read(), write(), and reset(); they can also be changed through QObject's set and get functions. See QObject::setProperty() and QObject::property() for details.

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

## Member Function Documentation

### QMetaEnum QMetaProperty::enumerator () const

Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined.

See also isEnumType().

### bool QMetaProperty::isDesignable ( const QObject * object = 0 ) const

Returns true if this property is designable for the given object; otherwise returns false.

If no object is given, the function returns false if the `Q_PROPERTY`'s `DESIGNABLE` attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

### bool QMetaProperty::isEditable ( const QObject * object = 0 ) const

Returns true if the property is editable for the given object; otherwise returns false.

If no object is given, the function returns false if the `Q_PROPERTY`'s `DESIGNABLE` attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

### bool QMetaProperty::isEnumType () const

Returns true if the property's type is an enumeration value; otherwise returns false.

See also enumerator() and isFlagType().

### bool QMetaProperty::isFlagType () const

Returns true if the property's type is an enumeration value that is used as a flag; otherwise returns false.

Flags can be combined using the OR operator. A set type is implicitly also an enum type.

See also isEnumType() and enumerator().

### bool QMetaProperty::isReadable () const

Returns true if this property is readable; otherwise returns false.

See also read() and isWritable().

### bool QMetaProperty::isScriptable ( const QObject * object = 0 ) const

Returns true if the property is scriptable for the given object; otherwise returns false.

If no object is given, the function returns false if the `Q_PROPERTY`'s `DESIGNABLE` attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

### bool QMetaProperty::isStored ( const QObject * object = 0 ) const

Returns true if the property is stored for object; otherwise returns false.

If no object is given, the function returns false if the `Q_PROPERTY`'s `DESIGNABLE` attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

### bool QMetaProperty::isValid () const

Returns true if this property is valid (readable); otherwise returns false.

### bool QMetaProperty::isWritable () const

Returns true if this property is writable; otherwise returns false.

See also write() and isReadable().

### const char * QMetaProperty::name () const

Returns this property's name.

### QCoreVariant QMetaProperty::read ( const QObject * object ) const

Reads the property's value from the given object. Returns the value if it was able to read it; otherwise returns an invalid variant.

See also write() and isReadable().

### bool QMetaProperty::reset ( QObject * object ) const

Resets the property for the given object with a reset method. Returns true if the reset worked; otherwise returns false.

Reset methods are optional; only a few properties support them.

### QCoreVariant::Type QMetaProperty::type () const

Returns this property's type. The return value is one of the values of the QCoreVariant::Type enumeration.

### const char * QMetaProperty::typeName () const

Returns the name of this property's type.

### bool QMetaProperty::write ( QObject * object, const QCoreVariant & value ) const

Writes value as the property's value to the given object. Returns true if the write succeeded; otherwise returns false.

See also read() and isWritable().