![]() |
CopperSpice API
2.0.0
|
The QMetaProperty class provides meta data about a property. More...
Public Methods | |
| QMetaEnum | enumerator () const |
| bool | hasNotifySignal () const |
| bool | isConstant () const |
| bool | isDesignable (const QObject *object=nullptr) const |
| bool | isEnumType () const |
| bool | isFinal () const |
| bool | isFlagType () const |
| bool | isReadable () const |
| bool | isResettable () const |
| bool | isScriptable (const QObject *object=nullptr) const |
| bool | isStored (const QObject *object=nullptr) const |
| bool | isUser (const QObject *object=nullptr) const |
| bool | isValid () const |
| bool | isWritable () const |
| const QString & | name () const |
| QMetaMethod | notifySignal () const |
| int | notifySignalIndex () const |
| int | propertyIndex () const |
| QVariant | read (const QObject *obj) const |
| template<class T > | |
| T | read (const QObject *obj) const |
| bool | reset (QObject *obj) const |
| int | revision () const |
| void | setConstant () |
| void | setFinal () |
| template<class T > | |
| void | setNotifyMethod (T method) |
| template<class T > | |
| void | setResetMethod (void (T::*method)()) |
| void | setRevision (int value) |
| void | setTypeName (const QString &typeName) |
| QVariant::Type | type () const |
| const QString & | typeName () const |
| uint | userType () const |
| bool | write (QObject *object, const QVariant &value) const |
The QMetaProperty class provides meta data about a property. The property meta data is retrieved from the meta object for a given class. Refer to QMetaObject::property() and QMetaObject::propertyCount() for more information.
A property has a name and a data type as well as various other optional attributes. These include writable, designable, scriptable, and stored. The value of a property is set or retrieved using read(), write(), and reset(). The property can also be changed using QObject::setProperty() and QObject::property().
If the data type for the property is an enumeration the isEnumType() method will return true. If the property is a flag isEnumType() and isFlagType() both return true. A flag is a data type where values can be combined using the OR operator. For an enum or a flag the meta data for the data type is available by calling enumerator().
QMetaProperty objects can be copied. Each copy will refer to the same underlying property meta data.
| QMetaEnum QMetaProperty::enumerator | ( | ) | const |
Returns the enumerator if this property's type is an enumerator type, otherwise the returned value is undefined.
| bool QMetaProperty::hasNotifySignal | ( | ) | const |
Returns true if this property has a corresponding change notify signal, otherwise returns false.
| bool QMetaProperty::isConstant | ( | ) | const |
Returns true if the property is constant, otherwise returns false. A property is constant if the property's CONSTANT attribute is set.
| bool QMetaProperty::isDesignable | ( | const QObject * | object = nullptr | ) | const |
Returns true if this property is designable for the given object, otherwise returns false. If the given object is a nullptr and the Designable property exists, then true is returned.
| bool QMetaProperty::isEnumType | ( | ) | const |
Returns true if the property's type is an enumeration value, otherwise returns false.
| bool QMetaProperty::isFinal | ( | ) | const |
Returns true if the property is final, otherwise returns false. A property is final if the property's FINAL attribute is set.
| 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 flag type is also considered an enum type.
| bool QMetaProperty::isReadable | ( | ) | const |
Returns true if this property is readable, otherwise returns false.
| bool QMetaProperty::isResettable | ( | ) | const |
Returns true if this property can be reset to a default value, otherwise returns false.
| bool QMetaProperty::isScriptable | ( | const QObject * | object = nullptr | ) | const |
Returns true if this property is scriptable for the given object, otherwise returns false. If the given object is a nullptr and the Scriptable property exists, then true is returned.
| bool QMetaProperty::isStored | ( | const QObject * | object = nullptr | ) | const |
Returns true if this property is stored for the given object, otherwise returns false. If the given object is a nullptr and the Stored property exists, then true is returned.
| bool QMetaProperty::isUser | ( | const QObject * | object = nullptr | ) | const |
Returns true if this property is the user property for the given object, otherwise returns false. If the given object is a nullptr and the User property exists, then true is returned.
| bool QMetaProperty::isValid | ( | ) | const |
Returns true if this property is readable, otherwise returns false.
| bool QMetaProperty::isWritable | ( | ) | const |
Returns true if this property is writable, otherwise returns false.
| const QString & QMetaProperty::name | ( | ) | const |
Returns the name of this property.
| QMetaMethod QMetaProperty::notifySignal | ( | ) | const |
Returns the QMetaMethod instance of the property change notifying signal if one was specified, otherwise returns an invalid QMetaMethod.
| int QMetaProperty::notifySignalIndex | ( | ) | const |
Returns the index of the property change notifying signal if one was specified, otherwise returns -1.
| int QMetaProperty::propertyIndex | ( | ) | const |
Returns the index of this property which indicates the position in the QMetaObject.
Reads the property's value from the given obj. Returns the property value as a QVariant if valid, otherwise returns a QVariant which is invalid.
| T QMetaProperty::read | ( | const QObject * | obj | ) | const |
Reads the property's value from the given obj. Returns the property value if valid, otherwise returns a default constructed T.
| bool QMetaProperty::reset | ( | QObject * | obj | ) | const |
| int QMetaProperty::revision | ( | ) | const |
Returns the revision of this property if one was specified by REVISION, otherwise returns 0.
| void QMetaProperty::setConstant | ( | ) |
Sets this property to constant which means the value of the property can not change.
| void QMetaProperty::setFinal | ( | ) |
Sets this property to final which means the property can not be overridden in a child class.
| void QMetaProperty::setNotifyMethod | ( | T | method | ) |
Sets the notify method of this property to method.
| void QMetaProperty::setResetMethod | ( | void (T::*)() | method | ) |
Sets the reset method of this property to method.
| void QMetaProperty::setRevision | ( | int | value | ) |
Sets the revision of this property to the given value.
| void QMetaProperty::setTypeName | ( | const QString & | typeName | ) |
Sets the type name of this property to typeName.
| QVariant::Type QMetaProperty::type | ( | ) | const |
Returns this property's data type. The return value is one of the values of the QVariant::Type enumeration.
| const QString & QMetaProperty::typeName | ( | ) | const |
| uint QMetaProperty::userType | ( | ) | const |
Returns this property's user type. The return value is one of the values that are registered with QVariant or QVariant::Invalid if the type is not registered.
Writes value as the property's value to the given object. Returns true if the write succeeded, otherwise returns false.