diff options
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
| -rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index a5d34eac707..c7e50788b45 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -469,6 +469,33 @@ QMetaType QMetaObject::metaType() const } } +static inline QByteArrayView objectMetaObjectHash(const QMetaObject *m) +{ + // metaObjectHash didn't exist before revision 14 + if (QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && priv(m->d.data)->revision < 14) + return {}; + const auto index = priv(m->d.data)->metaObjectHashIndex; + if (index == -1) + return {}; + return stringDataView(m, index); +} + +/*! + \since 6.11 + + Returns the revisioned hash of the contents of this QMetaObject or nullptr. + + The hash has the following format <hash_revision>$<hash_b64>, where + hash_revision is an integer and hash_b64 is the base64 encoding of the + hash. + + Note that only hashes of the same revision should be compared. +*/ +const char *QMetaObject::metaObjectHash() const +{ + return objectMetaObjectHash(this).constData(); +} + /*! Returns the method offset for this class; i.e. the index position of this class's first member function. @@ -4405,6 +4432,34 @@ bool QMetaProperty::isFinal() const } /*! + \since 6.11 + Returns \c true if the property is virtual; otherwise returns \c false. + + A property is virtual if the \c{Q_PROPERTY()}'s \c VIRTUAL attribute + is set. +*/ +bool QMetaProperty::isVirtual() const +{ + if (!mobj) + return false; + return data.flags() & Virtual; +} + +/*! + \since 6.11 + Returns \c true if the property does override; otherwise returns \c false. + + A property does override if the \c{Q_PROPERTY()}'s \c OVERRIDE attribute + is set. +*/ +bool QMetaProperty::isOverride() const +{ + if (!mobj) + return false; + return data.flags() & Override; +} + +/*! \since 5.15 Returns \c true if the property is required; otherwise returns \c false. |
