PythonQt
PythonQtMethodInfo Class Reference

stores information about a specific signal/slot/method More...

#include <PythonQtMethodInfo.h>

Inheritance diagram for PythonQtMethodInfo:
PythonQtSlotInfo

Classes

struct  ParameterInfo
 stores various informations about a parameter/type name More...

Public Types

enum  ParameterType { Unknown = -1 , Variant = -2 }

Public Member Functions

 PythonQtMethodInfo ()
 ~PythonQtMethodInfo ()
 PythonQtMethodInfo (const QMetaMethod &meta, PythonQtClassInfo *classInfo)
 PythonQtMethodInfo (const QByteArray &typeName, const QList< QByteArray > &args)
 PythonQtMethodInfo (const PythonQtMethodInfo &other)
int parameterCount () const
 returns the number of parameters including the return value
const QList< ParameterInfo > & parameters () const
 get the parameter infos
bool shouldAllowThreads () const

Static Public Member Functions

static const PythonQtMethodInfo * getCachedMethodInfo (const QMetaMethod &method, PythonQtClassInfo *classInfo)
static const PythonQtMethodInfo * getCachedMethodInfoFromArgumentList (int numArgs, const char **args)
 get the cached method info using the passed in list of return value and arguments, return value needs to be passed as first arg
static void cleanupCachedMethodInfos ()
 cleanup the cache
static int nameToType (const char *name)
 returns the id for the given type (using an internal dictionary)
static void addParameterTypeAlias (const QByteArray &alias, const QByteArray &name)
 add an alias for a typename, e.g. QObjectList and QList<QObject*>.
static void fillParameterInfo (ParameterInfo &type, const QByteArray &name, PythonQtClassInfo *classInfo=nullptr)
 fill the parameter info for the given type name
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 int getInnerTemplateMetaType (const QByteArray &typeName)
 returns the inner type id of a simple template of the form SomeObject<InnerType>
static QByteArray getInnerTemplateTypeName (const QByteArray &typeName)
 returns the inner type name of a simple template of the form SomeObject<InnerType>
static QByteArray getInnerListTypeName (const QByteArray &typeName)
 returns the inner type name of a simple template or the typename without appended "List".

Protected Member Functions

void setupAllowThreads ()

Protected Attributes

QList< ParameterInfo > _parameters
bool _shouldAllowThreads

Static Protected Attributes

static QHash< QByteArray, int > _parameterTypeDict
static QHash< QByteArray, QByteArray > _parameterNameAliases
static QHash< QByteArray, PythonQtMethodInfo * > _cachedSignatures
 stores the cached signatures of methods to speedup mapping from Qt to Python types
static QHash< int, ParameterInfo > _cachedParameterInfos

Detailed Description

stores information about a specific signal/slot/method

Definition at line 58 of file PythonQtMethodInfo.h.

Member Enumeration Documentation

◆ ParameterType

Enumerator
Unknown 
Variant 

Definition at line 61 of file PythonQtMethodInfo.h.

Constructor & Destructor Documentation

◆ PythonQtMethodInfo() [1/4]

◆ ~PythonQtMethodInfo()

PythonQtMethodInfo::~PythonQtMethodInfo ( )
inline

Definition at line 80 of file PythonQtMethodInfo.h.

80{};

◆ PythonQtMethodInfo() [2/4]

PythonQtMethodInfo::PythonQtMethodInfo ( const QMetaMethod & meta,
PythonQtClassInfo * classInfo )

◆ PythonQtMethodInfo() [3/4]

PythonQtMethodInfo::PythonQtMethodInfo ( const QByteArray & typeName,
const QList< QByteArray > & args )

◆ PythonQtMethodInfo() [4/4]

PythonQtMethodInfo::PythonQtMethodInfo ( const PythonQtMethodInfo & other)
inline

Definition at line 83 of file PythonQtMethodInfo.h.

84 {
87 }
QList< ParameterInfo > _parameters

References _parameters, _shouldAllowThreads, and PythonQtMethodInfo().

Member Function Documentation

◆ addParameterTypeAlias()

void PythonQtMethodInfo::addParameterTypeAlias ( const QByteArray & alias,
const QByteArray & name )
static

add an alias for a typename, e.g. QObjectList and QList<QObject*>.

◆ cleanupCachedMethodInfos()

void PythonQtMethodInfo::cleanupCachedMethodInfos ( )
static

cleanup the cache

◆ fillParameterInfo()

void PythonQtMethodInfo::fillParameterInfo ( ParameterInfo & type,
const QByteArray & name,
PythonQtClassInfo * classInfo = nullptr )
static

fill the parameter info for the given type name

◆ getCachedMethodInfo()

const PythonQtMethodInfo * PythonQtMethodInfo::getCachedMethodInfo ( const QMetaMethod & method,
PythonQtClassInfo * classInfo )
static

returns the method info of the signature, uses a cache internally to speed up multiple requests for the same method, classInfo is passed to allow local enum resolution (if NULL is passed, no local enums are recognized)

References PythonQtMethodInfo().

Referenced by PythonQtSlotInfo::PythonQtSlotInfo().

◆ getCachedMethodInfoFromArgumentList()

const PythonQtMethodInfo * PythonQtMethodInfo::getCachedMethodInfoFromArgumentList ( int numArgs,
const char ** args )
static

get the cached method info using the passed in list of return value and arguments, return value needs to be passed as first arg

References PythonQtMethodInfo().

◆ getInnerListTypeName()

QByteArray PythonQtMethodInfo::getInnerListTypeName ( const QByteArray & typeName)
static

returns the inner type name of a simple template or the typename without appended "List".

Referenced by PythonQtConvertListOfKnownClassToPythonList(), and PythonQtConvertPythonListToListOfKnownClass().

◆ getInnerTemplateMetaType()

int PythonQtMethodInfo::getInnerTemplateMetaType ( const QByteArray & typeName)
static

◆ getInnerTemplateTypeName()

QByteArray PythonQtMethodInfo::getInnerTemplateTypeName ( const QByteArray & typeName)
static

returns the inner type name of a simple template of the form SomeObject<InnerType>

Referenced by PythonQtConvertIntegerMapToPython(), PythonQtConvertPairToPython(), PythonQtConvertPythonToIntegerMap(), and PythonQtConvertPythonToPair().

◆ getParameterInfoForMetaType()

const ParameterInfo & PythonQtMethodInfo::getParameterInfoForMetaType ( int type)
static

returns a parameter info for the given metatype (and creates and caches one if it is not yet present)

◆ nameToType()

int PythonQtMethodInfo::nameToType ( const char * name)
static

returns the id for the given type (using an internal dictionary)

◆ parameterCount()

int PythonQtMethodInfo::parameterCount ( ) const
inline

returns the number of parameters including the return value

Definition at line 100 of file PythonQtMethodInfo.h.

100{ return _parameters.size(); };

References _parameters.

◆ parameters()

const QList< ParameterInfo > & PythonQtMethodInfo::parameters ( ) const
inline

get the parameter infos

Definition at line 106 of file PythonQtMethodInfo.h.

106{ return _parameters; }

References _parameters.

Referenced by PythonQtSlotInfo::PythonQtSlotInfo().

◆ setupAllowThreads()

void PythonQtMethodInfo::setupAllowThreads ( )
protected

◆ shouldAllowThreads()

bool PythonQtMethodInfo::shouldAllowThreads ( ) const
inline

returns if the GIL should be released when calling this method. This is the default, but it will return false if any of the parameters is a PythonQtObjectPtr or PyObject*.

Definition at line 129 of file PythonQtMethodInfo.h.

129{ return _shouldAllowThreads; }

References _shouldAllowThreads.

Referenced by PythonQtSlotInfo::PythonQtSlotInfo().

Member Data Documentation

◆ _cachedParameterInfos

QHash<int, ParameterInfo> PythonQtMethodInfo::_cachedParameterInfos
staticprotected

Definition at line 140 of file PythonQtMethodInfo.h.

◆ _cachedSignatures

QHash<QByteArray, PythonQtMethodInfo*> PythonQtMethodInfo::_cachedSignatures
staticprotected

stores the cached signatures of methods to speedup mapping from Qt to Python types

Definition at line 138 of file PythonQtMethodInfo.h.

◆ _parameterNameAliases

QHash<QByteArray, QByteArray> PythonQtMethodInfo::_parameterNameAliases
staticprotected

Definition at line 135 of file PythonQtMethodInfo.h.

◆ _parameters

QList<ParameterInfo> PythonQtMethodInfo::_parameters
protected

◆ _parameterTypeDict

QHash<QByteArray, int> PythonQtMethodInfo::_parameterTypeDict
staticprotected

Definition at line 134 of file PythonQtMethodInfo.h.

◆ _shouldAllowThreads

bool PythonQtMethodInfo::_shouldAllowThreads
protected

The documentation for this class was generated from the following file: