summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index e584fbba8e..f0cef22b6f 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -207,6 +207,7 @@ public:
inline uint parameterTypeInfo(int index) const;
inline int parameterType(int index) const;
inline void getParameterTypes(int *types) const;
+ inline QByteArray parameterTypeName(int index) const;
inline QList<QByteArray> parameterTypes() const;
inline QList<QByteArray> parameterNames() const;
inline QByteArray tag() const;
@@ -1780,6 +1781,12 @@ void QMetaMethodPrivate::getParameterTypes(int *types) const
}
}
+QByteArray QMetaMethodPrivate::parameterTypeName(int index) const
+{
+ int paramsIndex = parametersDataIndex();
+ return typeNameFromTypeInfo(mobj, mobj->d.data[paramsIndex + index]);
+}
+
QList<QByteArray> QMetaMethodPrivate::parameterTypes() const
{
Q_ASSERT(priv(mobj->d.data)->revision >= 7);
@@ -1961,6 +1968,20 @@ QList<QByteArray> QMetaMethod::parameterTypes() const
}
/*!
+ \since 6.0
+ Returns the name of the type at position \a index
+ If there is no parameter at \a index, returns an empty QByteArray
+
+ \sa parameterNames()
+ */
+QByteArray QMetaMethod::parameterTypeName(int index) const
+{
+ if (!mobj || index < 0 || index >= parameterCount())
+ return {};
+ return QMetaMethodPrivate::get(this)->parameterTypeName(index);
+}
+
+/*!
Returns a list of parameter names.
\sa parameterTypes(), methodSignature()