From 300dec66ce18b63a08027ef9f200117e87902274 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 7 May 2021 09:21:23 +0200 Subject: QMetaMethod: Store method constness in metaobject system [ChangeLog][QtCore][QMetaMethod] It is now possible to query the constness of a method with QMetaMethod::isConst. Change-Id: I8a94480b8074ef5b30555aeccd64937c4c6d97d4 Reviewed-by: Andrei Golubev Reviewed-by: Ulf Hermann --- src/corelib/kernel/qmetaobject.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/corelib/kernel/qmetaobject.cpp') diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index a574bec179..b09fe933e6 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2139,6 +2139,23 @@ int QMetaMethod::revision() const return 0; } +/*! + \since 6.2 + + Returns whether the method is const qualified. + + \note This method might errorneously return \false for a const method + if it belongs to a library compiled against an older version of Qt. + */ +bool QMetaMethod::isConst() const +{ + if (!mobj) + return false; + if (QMetaObjectPrivate::get(mobj)->revision < 10) + return false; + return data.flags() & MethodIsConst; +} + /*! Returns the access specification of this method (private, protected, or public). -- cgit v1.2.3