summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobject.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-05-07 09:21:23 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2021-05-07 21:50:58 +0200
commit300dec66ce18b63a08027ef9f200117e87902274 (patch)
treeab4719e81ceff1f7268a358f93a4d7a289e73c92 /src/corelib/kernel/qmetaobject.cpp
parentd5c3e1336bce42df53d4b525237244486ba5422d (diff)
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 <andrei.golubev@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp17
1 files changed, 17 insertions, 0 deletions
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
@@ -2140,6 +2140,23 @@ int QMetaMethod::revision() const
}
/*!
+ \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).