![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qmetaobject.h>
Collaboration diagram for QMetaProperty:Public Member Functions | |
| constexpr | QMetaProperty () |
| const char * | name () const |
| Returns this property's name. | |
| const char * | typeName () const |
| Returns the name of this property's type. | |
| int | userType () const |
| int | typeId () const |
| QMetaType | metaType () const |
| int | propertyIndex () const |
| int | relativePropertyIndex () const |
| bool | isReadable () const |
Returns true if this property is readable; otherwise returns false. | |
| bool | isWritable () const |
Returns true if this property is writable; otherwise returns false. | |
| bool | isResettable () const |
Returns true if this property can be reset to a default value; otherwise returns false. | |
| bool | isDesignable () const |
Returns false if the {Q_PROPERTY()}'s DESIGNABLE attribute is false; otherwise returns true. | |
| bool | isScriptable () const |
Returns false if the {Q_PROPERTY()}'s SCRIPTABLE attribute is false; otherwise returns true. | |
| bool | isStored () const |
Returns true if the property is stored; otherwise returns false. | |
| bool | isUser () const |
Returns false if the {Q_PROPERTY()}'s USER attribute is false. | |
| bool | isConstant () const |
| bool | isFinal () const |
| bool | isRequired () const |
| bool | isBindable () const |
| bool | isFlagType () const |
Returns true if the property's type is an enumeration value that is used as a flag; otherwise returns false. | |
| bool | isEnumType () const |
Returns true if the property's type is an enumeration value; otherwise returns false. | |
| QMetaEnum | enumerator () const |
| Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined. | |
| bool | hasNotifySignal () const |
Returns true if this property has a corresponding change notify signal; otherwise returns false. | |
| QMetaMethod | notifySignal () const |
| int | notifySignalIndex () const |
| int | revision () const |
| QVariant | read (const QObject *obj) const |
| Reads the property's value from the given object. | |
| bool | write (QObject *obj, const QVariant &value) const |
| Writes value as the property's value to the given object. | |
| bool | write (QObject *obj, QVariant &&value) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | reset (QObject *obj) const |
| Resets the property for the given object with a reset method. | |
| QUntypedBindable | bindable (QObject *object) const |
| QVariant | readOnGadget (const void *gadget) const |
| bool | writeOnGadget (void *gadget, const QVariant &value) const |
| bool | writeOnGadget (void *gadget, QVariant &&value) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| bool | resetOnGadget (void *gadget) const |
| bool | hasStdCppSet () const |
| bool | isAlias () const |
| bool | isValid () const |
Returns true if this property is valid (readable); otherwise returns false. | |
| const QMetaObject * | enclosingMetaObject () const |
Friends | |
| struct | QMetaObject |
| struct | QMetaObjectPrivate |
\inmodule QtCore
The QMetaProperty class provides meta-data about a property.
Property meta-data is obtained from an object's meta-object. See QMetaObject::property() and QMetaObject::propertyCount() for details.
Definition at line 321 of file qmetaobject.h.
|
inlineconstexpr |
Definition at line 324 of file qmetaobject.h.
| QUntypedBindable QMetaProperty::bindable | ( | QObject * | object | ) | const |
If the property doesn't support bindings, the returned interface will be invalid.
Definition at line 3758 of file qmetaobject.cpp.
References bindable(), QMetaObject::BindableProperty, QMetaObject::metacall(), and QMetaObject::propertyOffset().
Referenced by QUntypedBindable::QUntypedBindable(), bindable(), QQmlAnyBinding::ofProperty(), QQmlAnyBinding::removeBindingFrom(), and QQmlAnyBinding::takeFrom().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 379 of file qmetaobject.h.
| QMetaEnum QMetaProperty::enumerator | ( | ) | const |
Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined.
Definition at line 3613 of file qmetaobject.cpp.
Referenced by QQmlPropertyPrivate::writeEnumProperty().
Here is the caller graph for this function:| bool QMetaProperty::hasNotifySignal | ( | ) | const |
Returns true if this property has a corresponding change notify signal; otherwise returns false.
Definition at line 3850 of file qmetaobject.cpp.
Referenced by QQmlWatchProxy::QQmlWatchProxy(), QUntypedBindable::QUntypedBindable(), QMetaObjectBuilder::addProperty(), QQmlProperty::connectNotifySignal(), QQmlProperty::connectNotifySignal(), QQmlPropertyPrivate::findSignalByName(), QQmlDesignerMetaObject::metaCall(), and QQmlBindEntry::setTarget().
Here is the caller graph for this function:| bool QMetaProperty::hasStdCppSet | ( | ) | const |
Returns true if the property has a C++ setter function that follows Qt's standard "name" / "setName" pattern. Designer and uic query hasStdCppSet() in order to avoid expensive QObject::setProperty() calls. All properties in Qt [should] follow this pattern.
Definition at line 3523 of file qmetaobject.cpp.
References StdCppSet.
Referenced by QMetaObjectBuilder::addProperty().
Here is the caller graph for this function:| bool QMetaProperty::isAlias | ( | ) | const |
Returns true if the property is an alias. This is for instance true for a property declared in QML as 'property alias'.
Definition at line 3537 of file qmetaobject.cpp.
References Alias.
| bool QMetaProperty::isBindable | ( | ) | const |
true if the {Q_PROPERTY()} exposes binding functionality; otherwise returns false.This implies that you can create bindings that use this property as a dependency or install QPropertyObserver objects on this property. Unless the property is readonly, you can also set a binding on this property.
Definition at line 4039 of file qmetaobject.cpp.
References Bindable.
Referenced by QUntypedBindable::QUntypedBindable(), and removePendingQPropertyBinding().
Here is the caller graph for this function:| bool QMetaProperty::isConstant | ( | ) | const |
true if the property is constant; otherwise returns false.A property is constant if the {Q_PROPERTY()}'s CONSTANT attribute is set.
Definition at line 3995 of file qmetaobject.cpp.
References Constant.
Referenced by QMetaObjectBuilder::addProperty(), and QQmlProperty::needsNotifySignal().
Here is the caller graph for this function:| bool QMetaProperty::isDesignable | ( | ) | const |
Returns false if the {Q_PROPERTY()}'s DESIGNABLE attribute is false; otherwise returns true.
Definition at line 3936 of file qmetaobject.cpp.
References Designable.
Referenced by QMetaObjectBuilder::addProperty().
Here is the caller graph for this function:| bool QMetaProperty::isEnumType | ( | ) | const |
Returns true if the property's type is an enumeration value; otherwise returns false.
Definition at line 3507 of file qmetaobject.cpp.
References EnumOrFlag, and QMetaEnum::name().
Referenced by QMetaObjectBuilder::addProperty(), isFlagType(), write(), and QQmlPropertyPrivate::writeEnumProperty().
Here is the call graph for this function:
Here is the caller graph for this function:| bool QMetaProperty::isFinal | ( | ) | const |
true if the property is final; otherwise returns false.A property is final if the {Q_PROPERTY()}'s FINAL attribute is set.
Definition at line 4009 of file qmetaobject.cpp.
References Final.
Referenced by QMetaObjectBuilder::addProperty().
Here is the caller graph for this function:| 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 implicitly also an enum type.
Definition at line 3496 of file qmetaobject.cpp.
References isEnumType(), and QMetaEnum::isFlag().
Referenced by write(), and QQmlPropertyPrivate::writeEnumProperty().
Here is the call graph for this function:
Here is the caller graph for this function:| bool QMetaProperty::isReadable | ( | ) | const |
Returns true if this property is readable; otherwise returns false.
Definition at line 3837 of file qmetaobject.cpp.
References Readable.
Referenced by QMetaObjectBuilder::addProperty(), allSubObjects(), generateInterfaceXml(), propertyNameListForWritableProperties(), and readAllProperties().
Here is the caller graph for this function:| bool QMetaProperty::isRequired | ( | ) | const |
true if the property is required; otherwise returns false.A property is final if the {Q_PROPERTY()}'s REQUIRED attribute is set.
Definition at line 4023 of file qmetaobject.cpp.
References Required.
| bool QMetaProperty::isResettable | ( | ) | const |
Returns true if this property can be reset to a default value; otherwise returns false.
Definition at line 3825 of file qmetaobject.cpp.
References Resettable.
Referenced by QMetaObjectBuilder::addProperty(), reset(), and write().
Here is the caller graph for this function:| bool QMetaProperty::isScriptable | ( | ) | const |
Returns false if the {Q_PROPERTY()}'s SCRIPTABLE attribute is false; otherwise returns true.
Definition at line 3949 of file qmetaobject.cpp.
References Scriptable.
Referenced by QMetaObjectBuilder::addProperty(), generateInterfaceXml(), qDBusPropertyGet(), readAllProperties(), and writeProperty().
Here is the caller graph for this function:| bool QMetaProperty::isStored | ( | ) | const |
Returns true if the property is stored; otherwise returns false.
The function returns false if the {Q_PROPERTY()}'s STORED attribute is false; otherwise returns true.
Definition at line 3966 of file qmetaobject.cpp.
References Stored.
Referenced by QMetaObjectBuilder::addProperty().
Here is the caller graph for this function:| bool QMetaProperty::isUser | ( | ) | const |
Returns false if the {Q_PROPERTY()}'s USER attribute is false.
Otherwise it returns true, indicating the property is designated as the USER property, i.e., the one that the user can edit or that is significant in some other way.
Definition at line 3981 of file qmetaobject.cpp.
References User.
Referenced by QMetaObjectBuilder::addProperty(), and QMetaObject::userProperty().
Here is the caller graph for this function:
|
inline |
Returns true if this property is valid (readable); otherwise returns false.
Definition at line 378 of file qmetaobject.h.
Referenced by QUntypedBindable::QUntypedBindable(), QQmlBinding::dependencies(), QQmlPropertyPrivate::initProperty(), QQuickMultiPointHandlerPrivate::xMetaProperty(), and QQuickMultiPointHandlerPrivate::yMetaProperty().
Here is the caller graph for this function:| bool QMetaProperty::isWritable | ( | ) | const |
Returns true if this property is writable; otherwise returns false.
Definition at line 3923 of file qmetaobject.cpp.
References Writable.
Referenced by QMetaObjectBuilder::addProperty(), allSubObjects(), generateInterfaceXml(), propertyNameListForWritableProperties(), write(), write(), QQmlPropertyPrivate::writeEnumProperty(), and writeProperty().
Here is the caller graph for this function:| QMetaType QMetaProperty::metaType | ( | ) | const |
Returns this property's QMetaType.
Definition at line 3450 of file qmetaobject.cpp.
References QMetaObject::d, and QMetaObject::Data::metaTypes.
Referenced by QUntypedBindable::QUntypedBindable(), QMetaObjectBuilder::addProperty(), QQuickDesignerSupportProperties::allPropertyNames(), allSubObjects(), doWriteProperties(), doWriteProperties(), doWriteProperties(), doWriteProperty(), QQmlContextData::findObjectId(), generateInterfaceXml(), QQmlAbstractBinding::getPropertyData(), QQmlPropertyPrivate::initProperty(), QQuickDesignerSupportProperties::isPropertyQObject(), QDBusAbstractInterfacePrivate::property(), propertyNameListForWritableProperties(), QDBusAbstractInterfaceBase::qt_metacall(), readAllProperties(), typeName(), QV4::QQmlValueTypeWrapper::virtualPut(), QQmlPropertyPrivate::writeEnumProperty(), and writeProperty().
Here is the caller graph for this function:| const char * QMetaProperty::name | ( | ) | const |
Returns this property's name.
Definition at line 3392 of file qmetaobject.cpp.
References rawStringData().
Referenced by QUntypedBindable::QUntypedBindable(), QMetaObjectBuilder::addProperty(), QQuickDesignerSupportProperties::allPropertyNames(), allSubObjects(), QQmlBinding::dependencies(), doWriteProperties(), doWriteProperties(), doWriteProperties(), QQmlContextData::findObjectId(), for(), generateInterfaceXml(), QQmlProperty::name(), QQmlDesignerMetaObject::notifyPropertyChange(), notifySignalIndex(), QDBusAbstractInterfacePrivate::property(), propertyNameListForWritableProperties(), and readAllProperties().
Here is the call graph for this function:
Here is the caller graph for this function:| QMetaMethod QMetaProperty::notifySignal | ( | ) | const |
Returns the QMetaMethod instance of the property change notifying signal if one was specified, otherwise returns an invalid QMetaMethod.
Definition at line 3865 of file qmetaobject.cpp.
References QMetaObject::method(), and notifySignalIndex().
Referenced by QMetaObjectBuilder::addProperty(), QQmlProperty::connectNotifySignal(), QQmlPropertyPrivate::findSignalByName(), and QQmlBindEntry::setTarget().
Here is the call graph for this function:
Here is the caller graph for this function:| int QMetaProperty::notifySignalIndex | ( | ) | const |
Returns the index of the property change notifying signal if one was specified, otherwise returns -1.
Definition at line 3882 of file qmetaobject.cpp.
References QByteArray::constData(), IsUnresolvedSignal, QMetaObject::methodOffset(), name(), objectClassName(), qWarning, and stringData().
Referenced by QQmlWatchProxy::QQmlWatchProxy(), QUntypedBindable::QUntypedBindable(), QQmlProperty::connectNotifySignal(), and notifySignal().
Here is the call graph for this function:
Here is the caller graph for this function:| int QMetaProperty::propertyIndex | ( | ) | const |
Returns this property's index.
Definition at line 3467 of file qmetaobject.cpp.
References QMetaObject::propertyOffset().
Referenced by QUntypedBindable::QUntypedBindable().
Here is the call graph for this function:
Here is the caller graph for this function:Reads the property's value from the given object.
Returns the value if it was able to read it; otherwise returns an invalid variant.
Definition at line 3624 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::Data::data, QMetaObjectPrivate::flags, QMetaObject::metacall(), QMetaObject::Data::metaTypes, priv(), PropertyAccessInStaticMetaCall, QMetaObject::propertyOffset(), QMetaObject::ReadProperty, and QMetaObject::Data::static_metacall.
Referenced by QQuickPropertyChanges::actions(), QQuickDesignerSupportProperties::allPropertyNames(), allSubObjects(), QQmlContextData::findObjectId(), getValueFromProperty(), QQmlDesignerMetaObject::metaCall(), QQmlWatchProxy::notifyValueChanged(), propertyNameListForWritableProperties(), qDBusPropertyGet(), readAllProperties(), readOnGadget(), and QQuickDesignerSupportProperties::readQObjectProperty().
Here is the call graph for this function:
Here is the caller graph for this function:Reads the property's value from the given gadget. Returns the value if it was able to read it; otherwise returns an invalid variant.
This function should only be used if this is a property of a Q_GADGET
Definition at line 3773 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::Data::data, QMetaObjectPrivate::flags, priv(), PropertyAccessInStaticMetaCall, Q_ASSERT, read(), and QMetaObject::Data::static_metacall.
Referenced by VDMListDelegateDataType::value().
Here is the call graph for this function:
Here is the caller graph for this function:| int QMetaProperty::relativePropertyIndex | ( | ) | const |
Returns this property's index relative within the enclosing meta object.
Definition at line 3479 of file qmetaobject.cpp.
| 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.
Definition at line 3737 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::Data::data, QMetaObjectPrivate::flags, isResettable(), QMetaObject::metacall(), priv(), PropertyAccessInStaticMetaCall, QMetaObject::propertyOffset(), QMetaObject::ResetProperty, and QMetaObject::Data::static_metacall.
Here is the call graph for this function:| bool QMetaProperty::resetOnGadget | ( | void * | gadget | ) | const |
Resets the property for the given gadget with a reset method. Returns true if the reset worked; otherwise returns false.
Reset methods are optional; only a few properties support them.
This function should only be used if this is a property of a Q_GADGET
Definition at line 3813 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::Data::data, QMetaObjectPrivate::flags, priv(), PropertyAccessInStaticMetaCall, Q_ASSERT, and QMetaObject::Data::static_metacall.
Here is the call graph for this function:| int QMetaProperty::revision | ( | ) | const |
Returns the property revision if one was specified by REVISION, otherwise returns 0.
Definition at line 3910 of file qmetaobject.cpp.
Referenced by QMetaObjectBuilder::addProperty(), and main().
Here is the caller graph for this function:
|
inline |
Returns the storage type of the property. This is the same as metaType().id().
Definition at line 337 of file qmetaobject.h.
| const char * QMetaProperty::typeName | ( | ) | const |
Returns the name of this property's type.
Definition at line 3404 of file qmetaobject.cpp.
References QMetaType::isValid(), metaType(), and rawTypeNameFromTypeInfo().
Referenced by QQmlVMEResolvedList::QQmlVMEResolvedList(), QMetaObjectBuilder::addProperty(), QDBusAbstractInterfacePrivate::property(), QQmlProperty::propertyTypeName(), and writeProperty().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Returns this property's user type. The return value is one of the values that are registered with QMetaType.
This is equivalent to metaType().id()
Definition at line 336 of file qmetaobject.h.
Referenced by QQmlDesignerMetaObject::metaCall().
Here is the caller graph for this function:Writes value as the property's value to the given object.
Returns true if the write succeeded; otherwise returns false.
If value is not of the same type as the property, a conversion is attempted. An empty QVariant() is equivalent to a call to reset() if this property is resettable, or setting a default-constructed object otherwise.
Definition at line 3673 of file qmetaobject.cpp.
References isWritable(), and write().
Referenced by QtPrivate::PropertyAdaptorSlotObjectHelpers::bindingWrapper(), write(), writeOnGadget(), writeOnGadget(), and writeProperty().
Here is the call graph for this function:
Here is the caller graph for this function:This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 3684 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::Data::data, QMetaObjectPrivate::flags, isEnumType(), isFlagType(), isResettable(), isWritable(), QMetaEnum::keysToValue(), QMetaEnum::keyToValue(), QMetaObject::metacall(), QMetaObject::Data::metaTypes, ok, priv(), PropertyAccessInStaticMetaCall, QMetaObject::propertyOffset(), QMetaObject::Data::static_metacall, and QMetaObject::WriteProperty.
Here is the call graph for this function:Writes value as the property's value to the given gadget. Returns true if the write succeeded; otherwise returns false.
This function should only be used if this is a property of a Q_GADGET
Definition at line 3787 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::Data::data, QMetaObjectPrivate::flags, priv(), PropertyAccessInStaticMetaCall, Q_ASSERT, QMetaObject::Data::static_metacall, and write().
Referenced by doWriteProperties(), doWriteProperties(), doWriteProperties(), doWriteProperty(), and VDMListDelegateDataType::setValue().
Here is the call graph for this function:
Here is the caller graph for this function:This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 3797 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::Data::data, QMetaObjectPrivate::flags, priv(), PropertyAccessInStaticMetaCall, Q_ASSERT, QMetaObject::Data::static_metacall, and write().
Here is the call graph for this function:
|
friend |
Definition at line 407 of file qmetaobject.h.
|
friend |
Definition at line 408 of file qmetaobject.h.