Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\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 333 of file qmetaobject.h.
|
inlineconstexpr |
Definition at line 336 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 4044 of file qmetaobject.cpp.
|
inline |
Definition at line 391 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 3896 of file qmetaobject.cpp.
bool QMetaProperty::hasNotifySignal | ( | ) | const |
Returns true
if this property has a corresponding change notify signal; otherwise returns false
.
Definition at line 4136 of file qmetaobject.cpp.
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 3813 of file qmetaobject.cpp.
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 3827 of file qmetaobject.cpp.
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 4329 of file qmetaobject.cpp.
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 4285 of file qmetaobject.cpp.
bool QMetaProperty::isDesignable | ( | ) | const |
Returns false
if the {Q_PROPERTY()}'s
DESIGNABLE
attribute is false; otherwise returns true
.
Definition at line 4226 of file qmetaobject.cpp.
bool QMetaProperty::isEnumType | ( | ) | const |
Returns true
if the property's type is an enumeration value; otherwise returns false
.
Definition at line 3797 of file qmetaobject.cpp.
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 4299 of file qmetaobject.cpp.
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 3786 of file qmetaobject.cpp.
bool QMetaProperty::isReadable | ( | ) | const |
Returns true
if this property is readable; otherwise returns false
.
Definition at line 4123 of file qmetaobject.cpp.
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 4313 of file qmetaobject.cpp.
bool QMetaProperty::isResettable | ( | ) | const |
Returns true
if this property can be reset to a default value; otherwise returns false
.
Definition at line 4111 of file qmetaobject.cpp.
bool QMetaProperty::isScriptable | ( | ) | const |
Returns false
if the {Q_PROPERTY()}'s
SCRIPTABLE
attribute is false; otherwise returns true.
Definition at line 4239 of file qmetaobject.cpp.
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 4256 of file qmetaobject.cpp.
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 4271 of file qmetaobject.cpp.
|
inline |
Returns true
if this property is valid (readable); otherwise returns false
.
Definition at line 390 of file qmetaobject.h.
bool QMetaProperty::isWritable | ( | ) | const |
Returns true
if this property is writable; otherwise returns false.
Definition at line 4213 of file qmetaobject.cpp.
QMetaType QMetaProperty::metaType | ( | ) | const |
Returns this property's QMetaType.
Definition at line 3737 of file qmetaobject.cpp.
const char * QMetaProperty::name | ( | ) | const |
Returns this property's name.
Definition at line 3679 of file qmetaobject.cpp.
Referenced by testing.tools.encode_pdf_filter._PdfStream::RegisterByName().
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 4151 of file qmetaobject.cpp.
int QMetaProperty::notifySignalIndex | ( | ) | const |
Returns the index of the property change notifying signal if one was specified, otherwise returns -1.
Definition at line 4168 of file qmetaobject.cpp.
int QMetaProperty::propertyIndex | ( | ) | 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.
Definition at line 3907 of file qmetaobject.cpp.
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 4059 of file qmetaobject.cpp.
int QMetaProperty::relativePropertyIndex | ( | ) | const |
Returns this property's index relative within the enclosing meta object.
Definition at line 3769 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 4023 of file qmetaobject.cpp.
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 4099 of file qmetaobject.cpp.
int QMetaProperty::revision | ( | ) | const |
Returns the property revision if one was specified by Q_REVISION, otherwise returns 0. Since Qt 6.0, non-zero values are encoded and can be decoded using QTypeRevision::fromEncodedVersion().
Definition at line 4200 of file qmetaobject.cpp.
|
inline |
Returns the storage type of the property. This is the same as metaType().id().
Definition at line 349 of file qmetaobject.h.
const char * QMetaProperty::typeName | ( | ) | const |
Returns the name of this property's type.
Definition at line 3691 of file qmetaobject.cpp.
|
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 348 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 3956 of file qmetaobject.cpp.
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 3967 of file qmetaobject.cpp.
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 4073 of file qmetaobject.cpp.
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 4083 of file qmetaobject.cpp.
|
friend |
Definition at line 419 of file qmetaobject.h.
|
friend |
Definition at line 420 of file qmetaobject.h.