Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
\inmodule QtCore More...
#include <qmetaobject.h>
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 323 of file qmetaobject.h.
|
inlineconstexpr |
Definition at line 326 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 3846 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().
|
inline |
Definition at line 381 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 3701 of file qmetaobject.cpp.
Referenced by QQmlPropertyPrivate::writeEnumProperty().
bool QMetaProperty::hasNotifySignal | ( | ) | const |
Returns true
if this property has a corresponding change notify signal; otherwise returns false
.
Definition at line 3938 of file qmetaobject.cpp.
Referenced by QQmlWatchProxy::QQmlWatchProxy(), QUntypedBindable::QUntypedBindable(), QMetaObjectBuilder::addProperty(), QQmlProperty::connectNotifySignal(), QQmlProperty::connectNotifySignal(), and QQmlPropertyPrivate::findSignalByName().
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 3618 of file qmetaobject.cpp.
References StdCppSet.
Referenced by QMetaObjectBuilder::addProperty().
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 3632 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 4130 of file qmetaobject.cpp.
References Bindable.
Referenced by QUntypedBindable::QUntypedBindable(), and removePendingQPropertyBinding().
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 4086 of file qmetaobject.cpp.
References Constant.
Referenced by QMetaObjectBuilder::addProperty(), and QQmlProperty::needsNotifySignal().
bool QMetaProperty::isDesignable | ( | ) | const |
Returns false
if the {Q_PROPERTY()}'s
DESIGNABLE
attribute is false; otherwise returns true
.
Definition at line 4027 of file qmetaobject.cpp.
References Designable.
Referenced by QMetaObjectBuilder::addProperty().
bool QMetaProperty::isEnumType | ( | ) | const |
Returns true
if the property's type is an enumeration value; otherwise returns false
.
Definition at line 3602 of file qmetaobject.cpp.
References EnumOrFlag.
Referenced by QMetaObjectBuilder::addProperty(), write(), and QQmlPropertyPrivate::writeEnumProperty().
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 4100 of file qmetaobject.cpp.
References Final.
Referenced by QMetaObjectBuilder::addProperty().
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 3591 of file qmetaobject.cpp.
Referenced by write(), and QQmlPropertyPrivate::writeEnumProperty().
bool QMetaProperty::isReadable | ( | ) | const |
Returns true
if this property is readable; otherwise returns false
.
Definition at line 3925 of file qmetaobject.cpp.
References Readable.
Referenced by QMetaObjectBuilder::addProperty(), allSubObjects(), and propertyNameListForWritableProperties().
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 4114 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 3913 of file qmetaobject.cpp.
References Resettable.
Referenced by QMetaObjectBuilder::addProperty(), reset(), and write().
bool QMetaProperty::isScriptable | ( | ) | const |
Returns false
if the {Q_PROPERTY()}'s
SCRIPTABLE
attribute is false; otherwise returns true.
Definition at line 4040 of file qmetaobject.cpp.
References Scriptable.
Referenced by QMetaObjectBuilder::addProperty().
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 4057 of file qmetaobject.cpp.
References Stored.
Referenced by QMetaObjectBuilder::addProperty().
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 4072 of file qmetaobject.cpp.
References User.
Referenced by QMetaObjectBuilder::addProperty(), and QMetaObject::userProperty().
|
inline |
Returns true
if this property is valid (readable); otherwise returns false
.
Definition at line 380 of file qmetaobject.h.
References isReadable().
Referenced by QUntypedBindable::QUntypedBindable(), QQmlBinding::dependencies(), QQmlPropertyPrivate::initProperty(), QQuickMultiPointHandlerPrivate::xMetaProperty(), and QQuickMultiPointHandlerPrivate::yMetaProperty().
bool QMetaProperty::isWritable | ( | ) | const |
Returns true
if this property is writable; otherwise returns false.
Definition at line 4014 of file qmetaobject.cpp.
References Writable.
Referenced by QMetaObjectBuilder::addProperty(), allSubObjects(), propertyNameListForWritableProperties(), write(), write(), and QQmlPropertyPrivate::writeEnumProperty().
QMetaType QMetaProperty::metaType | ( | ) | const |
Returns this property's QMetaType.
Definition at line 3545 of file qmetaobject.cpp.
References QMetaObject::d.
Referenced by QUntypedBindable::QUntypedBindable(), QMetaObjectBuilder::addProperty(), QQuickDesignerSupportProperties::allPropertyNames(), allSubObjects(), doWriteProperties(), doWriteProperties(), doWriteProperties(), doWriteProperty(), QQmlContextData::findObjectId(), QQuickDesignerSupportProperties::isPropertyQObject(), propertyNameListForWritableProperties(), and QQmlPropertyPrivate::writeEnumProperty().
const char * QMetaProperty::name | ( | ) | const |
Returns this property's name.
Definition at line 3487 of file qmetaobject.cpp.
References rawStringData().
Referenced by QUntypedBindable::QUntypedBindable(), QMetaObjectBuilder::addProperty(), QtAndroidQuickViewEmbedding::addRootObjectSignalListener(), QQuickDesignerSupportProperties::allPropertyNames(), allSubObjects(), VDMListDelegateDataType::createMissingProperties(), QQmlBinding::dependencies(), doWriteProperties(), doWriteProperties(), doWriteProperties(), QQmlContextData::findObjectId(), for(), propertyNameListForWritableProperties(), QQuick3DCustomMaterial::updateSpatialNode(), and QQuick3DEffect::updateSpatialNode().
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 3953 of file qmetaobject.cpp.
References QMetaObject::method(), and notifySignalIndex().
Referenced by QMetaObjectBuilder::addProperty(), QtAndroidQuickViewEmbedding::addRootObjectSignalListener(), QQmlProperty::connectNotifySignal(), and QQmlPropertyPrivate::findSignalByName().
int QMetaProperty::notifySignalIndex | ( | ) | const |
Returns the index of the property change notifying signal if one was specified, otherwise returns -1.
Definition at line 3970 of file qmetaobject.cpp.
References QMetaObject::className(), IsUnresolvedSignal, QMetaObject::methodOffset(), qWarning, stringData(), and typeId().
Referenced by QQmlWatchProxy::QQmlWatchProxy(), QUntypedBindable::QUntypedBindable(), QQmlProperty::connectNotifySignal(), and notifySignal().
int QMetaProperty::propertyIndex | ( | ) | const |
Returns this property's index.
Definition at line 3562 of file qmetaobject.cpp.
References QMetaObject::propertyOffset().
Referenced by QUntypedBindable::QUntypedBindable().
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 3712 of file qmetaobject.cpp.
References QMetaObject::d, QMetaObject::metacall(), priv(), PropertyAccessInStaticMetaCall, QMetaObject::propertyOffset(), and QMetaObject::ReadProperty.
Referenced by QQuickPropertyChanges::actions(), QQuickDesignerSupportProperties::allPropertyNames(), allSubObjects(), QQmlContextData::findObjectId(), QtAndroidQuickViewEmbedding::getRootObjectProperty(), QQmlWatchProxy::notifyValueChanged(), propertyNameListForWritableProperties(), readObjectProperty(), readOnGadget(), and QQuickDesignerSupportProperties::readQObjectProperty().
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 3861 of file qmetaobject.cpp.
References QMetaObject::d, priv(), PropertyAccessInStaticMetaCall, Q_ASSERT, and read().
Referenced by VDMListDelegateDataType::value().
int QMetaProperty::relativePropertyIndex | ( | ) | const |
Returns this property's index relative within the enclosing meta object.
Definition at line 3574 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 3825 of file qmetaobject.cpp.
References QMetaObject::d, isResettable(), QMetaObject::metacall(), priv(), PropertyAccessInStaticMetaCall, QMetaObject::propertyOffset(), and QMetaObject::ResetProperty.
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 3901 of file qmetaobject.cpp.
References QMetaObject::d, priv(), PropertyAccessInStaticMetaCall, and Q_ASSERT.
int QMetaProperty::revision | ( | ) | const |
Returns the property revision if one was specified by REVISION, otherwise returns 0.
Definition at line 4001 of file qmetaobject.cpp.
Referenced by QMetaObjectBuilder::addProperty().
|
inline |
Returns the storage type of the property. This is the same as metaType().id().
Definition at line 339 of file qmetaobject.h.
Referenced by notifySignalIndex().
const char * QMetaProperty::typeName | ( | ) | const |
Returns the name of this property's type.
Definition at line 3499 of file qmetaobject.cpp.
References QMetaType::isValid(), QMetaEnum::metaType(), and typeNameFromTypeInfo().
Referenced by QQmlVMEResolvedList::QQmlVMEResolvedList(), and QMetaObjectBuilder::addProperty().
|
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 338 of file qmetaobject.h.
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 3761 of file qmetaobject.cpp.
References isWritable(), and write().
Referenced by QtPrivate::PropertyAdaptorSlotObjectHelpers::bindingWrapper(), QtAndroidQuickViewEmbedding::setRootObjectProperty(), write(), writeOnGadget(), and writeOnGadget().
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 3772 of file qmetaobject.cpp.
References QMetaObject::d, isEnumType(), isFlagType(), isResettable(), isWritable(), QMetaEnum::keysToValue(), QMetaEnum::keyToValue(), QMetaObject::metacall(), ok, priv(), PropertyAccessInStaticMetaCall, QMetaObject::propertyOffset(), and QMetaObject::WriteProperty.
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 3875 of file qmetaobject.cpp.
References QMetaObject::d, priv(), PropertyAccessInStaticMetaCall, Q_ASSERT, and write().
Referenced by doWriteProperties(), doWriteProperties(), doWriteProperties(), doWriteProperty(), and VDMListDelegateDataType::setValue().
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 3885 of file qmetaobject.cpp.
References QMetaObject::d, priv(), PropertyAccessInStaticMetaCall, Q_ASSERT, and write().
|
friend |
Definition at line 409 of file qmetaobject.h.
|
friend |
Definition at line 410 of file qmetaobject.h.