1 #ifndef _PYTHONQTMETHODINFO_H
2 #define _PYTHONQTMETHODINFO_H
51 #include <QMetaMethod>
83 _shouldAllowThreads =
true;
110 const QList<ParameterInfo>&
parameters()
const {
return _parameters; }
163 _slotIndex = info._slotIndex;
165 _decorator = info._decorator;
167 _upcastingOffset = 0;
176 _slotIndex = slotIndex;
178 _decorator = decorator;
180 _upcastingOffset = 0;
214 QString
fullSignature(
bool skipReturnValue =
false,
int optionalArgsIndex = -1)
const;
220 QByteArray
slotName(
bool removeDecorators =
false)
const;
225 QStringList
overloads(
bool skipReturnValue =
false)
const;
246 int _upcastingOffset;
248 static bool _globalShouldAllowThreads;
a class that stores all required information about a Qt object (and an optional associated C++ class ...
stores information about a specific signal/slot/method
static const ParameterInfo & getParameterInfoForMetaType(int type)
returns a parameter info for the given metatype (and creates and caches one if it is not yet present)
static QByteArray getInnerTemplateTypeName(const QByteArray &typeName)
returns the inner type name of a simple template of the form SomeObject<InnerType>
static void addParameterTypeAlias(const QByteArray &alias, const QByteArray &name)
add an alias for a typename, e.g. QObjectList and QList<QObject*>.
static QHash< QByteArray, QByteArray > _parameterNameAliases
static int getInnerTemplateMetaType(const QByteArray &typeName)
returns the inner type id of a simple template of the form SomeObject<InnerType>
static QHash< QByteArray, int > _parameterTypeDict
static QByteArray getInnerListTypeName(const QByteArray &typeName)
returns the inner type name of a simple template or the typename without appended "List".
const QList< ParameterInfo > & parameters() const
get the parameter infos
static void cleanupCachedMethodInfos()
cleanup the cache
PythonQtMethodInfo(const QByteArray &typeName, const QList< QByteArray > &args)
PythonQtMethodInfo(const PythonQtMethodInfo &other)
QList< ParameterInfo > _parameters
static const PythonQtMethodInfo * getCachedMethodInfoFromArgumentList(int numArgs, const char **args)
get the cached method info using the passed in list of return value and arguments,...
static QHash< int, ParameterInfo > _cachedParameterInfos
int parameterCount() const
returns the number of parameters including the return value
static int nameToType(const char *name)
returns the id for the given type (using an internal dictionary)
static void fillParameterInfo(ParameterInfo &type, const QByteArray &name, PythonQtClassInfo *classInfo=nullptr)
fill the parameter info for the given type name
static QHash< QByteArray, PythonQtMethodInfo * > _cachedSignatures
stores the cached signatures of methods to speedup mapping from Qt to Python types
static const PythonQtMethodInfo * getCachedMethodInfo(const QMetaMethod &method, PythonQtClassInfo *classInfo)
bool shouldAllowThreads() const
PythonQtMethodInfo(const QMetaMethod &meta, PythonQtClassInfo *classInfo)
stores information about a slot, including a next pointer to overloaded slots
PythonQtSlotInfo(PythonQtClassInfo *classInfo, const QMetaMethod &meta, int slotIndex, QObject *decorator=nullptr, Type type=MemberSlot)
QByteArray getImplementingClassName() const
QStringList overloads(bool skipReturnValue=false) const
int slotIndex() const
get the index of the slot (needed for qt_metacall)
QList< ParameterInfo > arguments() const
get the parameter infos for the arguments, without return type and instance decorator.
QString fullSignature(bool skipReturnValue=false, int optionalArgsIndex=-1) const
get the full signature including return type
static bool getGlobalShouldAllowThreads()
Returns if calling slots should release the GIL to allow Python threads while being inside of C++.
QByteArray slotName(bool removeDecorators=false) const
get the short slot name
static void invokeQtMethod(QObject *obj, PythonQtSlotInfo *slot, void **argList)
Invoke the given slot on obj, save/restore thread state if needed.
bool isInstanceDecorator() const
returns if the slot is a decorator slot
void setNextInfo(PythonQtSlotInfo *next)
set the next overloaded slot
QByteArray signature() const
get the Qt signature of the slot
bool isClassDecorator() const
returns if the slot is a constructor slot
static void setGlobalShouldAllowThreads(bool flag)
Sets if calling slots should release the GIL to allow other Python threads while being inside of C++.
void setUpcastingOffset(int upcastingOffset)
void deleteOverloadsAndThis()
PythonQtSlotInfo(const PythonQtSlotInfo &info)
const QMetaMethod * metaMethod() const
QObject * decorator() const
PythonQtSlotInfo * nextInfo() const
get next overloaded slot (which has the same name)
int upcastingOffset() const
QByteArray typeName(const QMetaMethod &method)
stores various informations about a parameter/type name
bool passOwnershipToPython
char innerNamePointerCount