
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQMetaProperty class provides meta-data about a property.More...
| Header: | #include <QMetaProperty> |
| QMetaEnum | enumerator() const |
| bool | hasNotifySignal() const |
| bool | isConstant() const |
| bool | isDesignable(const QObject * object = 0) const |
| bool | isEnumType() const |
| bool | isFinal() const |
| bool | isFlagType() const |
| bool | isReadable() const |
| bool | isResettable() const |
| bool | isScriptable(const QObject * object = 0) const |
| bool | isStored(const QObject * object = 0) const |
| bool | isUser(const QObject * object = 0) const |
| bool | isValid() const |
| bool | isWritable() const |
| const char * | name() const |
| QMetaMethod | notifySignal() const |
| int | notifySignalIndex() const |
| int | propertyIndex() const |
| QVariant | read(const QObject * object) const |
| bool | reset(QObject * object) const |
| QVariant::Type | type() const |
| const char * | typeName() const |
| int | userType() const |
| bool | write(QObject * object, const QVariant & value) const |
TheQMetaProperty class provides meta-data about a property.
Property meta-data is obtained from an object's meta-object. SeeQMetaObject::property() andQMetaObject::propertyCount() for details.
A property has aname() and atype(), as well as various attributes that specify its behavior:isReadable(),isWritable(),isDesignable(),isScriptable(), andisStored().
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() andisFlagType() both return true. The enumerator for these types is available fromenumerator().
The property's values are set and retrieved withread(),write(), andreset(); they can also be changed throughQObject's set and get functions. SeeQObject::setProperty() andQObject::property() for details.
QMetaProperty objects can be copied by value. However, each copy will refer to the same underlying property meta-data.
See alsoQMetaObject,QMetaEnum,QMetaMethod, andQt's Property System.
Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined.
See alsoisEnumType() andisFlagType().
Returns true if this property has a corresponding change notify signal; otherwise returns false.
See alsonotifySignal().
Returns true if the property is constant; otherwise returns false.
A property is constant if theQ_PROPERTY()'sCONSTANT attribute is set.
This function was introduced in Qt 4.6.
Returns true if this property is designable for the givenobject; otherwise returns false.
If noobject is given, the function returns false if theQ_PROPERTY()'sDESIGNABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).
See alsoisScriptable() andisStored().
Returns true if the property's type is an enumeration value; otherwise returns false.
See alsoenumerator() andisFlagType().
Returns true if the property is final; otherwise returns false.
A property is final if theQ_PROPERTY()'sFINAL attribute is set.
This function was introduced in Qt 4.6.
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 implicitly also an enum type.
See alsoisEnumType(),enumerator(), andQMetaEnum::isFlag().
Returns true if this property is readable; otherwise returns false.
See alsoisWritable(),read(), andisValid().
Returns true if this property can be reset to a default value; otherwise returns false.
See alsoreset().
Returns true if the property is scriptable for the givenobject; otherwise returns false.
If noobject is given, the function returns false if theQ_PROPERTY()'sSCRIPTABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).
See alsoisDesignable() andisStored().
Returns true if the property is stored forobject; otherwise returns false.
If noobject is given, the function returns false if theQ_PROPERTY()'sSTORED attribute is false; otherwise returns true (if the attribute is true or is a function or expression).
See alsoisDesignable() andisScriptable().
Returns true if this property is designated as theUSER property, i.e., the one that the user can edit forobject or that is significant in some other way. Otherwise it returns false. e.g., thetext property is theUSER editable property of aQLineEdit.
Ifobject is null, the function returns false if theQ_PROPERTY()'sUSER attribute is false. Otherwise it returns true.
See alsoQMetaObject::userProperty(),isDesignable(), andisScriptable().
Returns true if this property is valid (readable); otherwise returns false.
See alsoisReadable().
Returns true if this property is writable; otherwise returns false.
See alsoisReadable() andwrite().
Returns this property's name.
Returns theQMetaMethod instance of the property change notifying signal if one was specified, otherwise returns an invalidQMetaMethod.
This function was introduced in Qt 4.5.
See alsohasNotifySignal().
Returns the index of the property change notifying signal if one was specified, otherwise returns -1.
This function was introduced in Qt 4.6.
See alsohasNotifySignal().
Returns this property's index.
This function was introduced in Qt 4.6.
Reads the property's value from the givenobject. Returns the value if it was able to read it; otherwise returns an invalid variant.
See alsowrite(),reset(), andisReadable().
Resets the property for the givenobject with a reset method. Returns true if the reset worked; otherwise returns false.
Reset methods are optional; only a few properties support them.
Returns this property's type. The return value is one of the values of theQVariant::Type enumeration.
See alsouserType(),typeName(), andname().
Returns the name of this property's type.
Returns this property's user type. The return value is one of the values that are registered withQMetaType, or 0 if the type is not registered.
This function was introduced in Qt 4.2.
See alsotype(),QMetaType, andtypeName().
Writesvalue as the property's value to the givenobject. Returns true if the write succeeded; otherwise returns false.
See alsoread(),reset(), andisWritable().
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.