PythonQt
Public Types | Public Member Functions | Static Public Member Functions | List of all members
PythonQtSlotInfo Class Reference

stores information about a slot, including a next pointer to overloaded slots More...

#include <PythonQtMethodInfo.h>

Inheritance diagram for PythonQtSlotInfo:
PythonQtMethodInfo

Public Types

enum  Type { MemberSlot , InstanceDecorator , ClassDecorator }
 
- Public Types inherited from PythonQtMethodInfo
enum  ParameterType { Unknown = -1 , Variant = -2 }
 

Public Member Functions

 PythonQtSlotInfo (const PythonQtSlotInfo &info)
 
 PythonQtSlotInfo (PythonQtClassInfo *classInfo, const QMetaMethod &meta, int slotIndex, QObject *decorator=nullptr, Type type=MemberSlot)
 
QList< ParameterInfoarguments () const
 get the parameter infos for the arguments, without return type and instance decorator. More...
 
void deleteOverloadsAndThis ()
 
const QMetaMethod * metaMethod () const
 
void setUpcastingOffset (int upcastingOffset)
 
int upcastingOffset () const
 
int slotIndex () const
 get the index of the slot (needed for qt_metacall) More...
 
PythonQtSlotInfonextInfo () const
 get next overloaded slot (which has the same name) More...
 
void setNextInfo (PythonQtSlotInfo *next)
 set the next overloaded slot More...
 
bool isInstanceDecorator () const
 returns if the slot is a decorator slot More...
 
bool isClassDecorator () const
 returns if the slot is a constructor slot More...
 
QObject * decorator () const
 
QString fullSignature (bool skipReturnValue=false, int optionalArgsIndex=-1) const
 get the full signature including return type More...
 
QByteArray signature () const
 get the Qt signature of the slot More...
 
QByteArray slotName (bool removeDecorators=false) const
 get the short slot name More...
 
QStringList overloads (bool skipReturnValue=false) const
 
QByteArray getImplementingClassName () const
 
- Public Member Functions inherited from PythonQtMethodInfo
 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 More...
 
const QList< ParameterInfo > & parameters () const
 get the parameter infos More...
 
bool shouldAllowThreads () const
 

Static Public Member Functions

static void invokeQtMethod (QObject *obj, PythonQtSlotInfo *slot, void **argList)
 Invoke the given slot on obj, save/restore thread state if needed. More...
 
static void setGlobalShouldAllowThreads (bool flag)
 Sets if calling slots should release the GIL to allow other Python threads while being inside of C++. More...
 
static bool getGlobalShouldAllowThreads ()
 Returns if calling slots should release the GIL to allow Python threads while being inside of C++. More...
 
- Static Public Member Functions inherited from PythonQtMethodInfo
static const PythonQtMethodInfogetCachedMethodInfo (const QMetaMethod &method, PythonQtClassInfo *classInfo)
 
static const PythonQtMethodInfogetCachedMethodInfoFromArgumentList (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 More...
 
static void cleanupCachedMethodInfos ()
 cleanup the cache More...
 
static int nameToType (const char *name)
 returns the id for the given type (using an internal dictionary) More...
 
static void addParameterTypeAlias (const QByteArray &alias, const QByteArray &name)
 add an alias for a typename, e.g. QObjectList and QList<QObject*>. More...
 
static void fillParameterInfo (ParameterInfo &type, const QByteArray &name, PythonQtClassInfo *classInfo=nullptr)
 fill the parameter info for the given type name More...
 
static const ParameterInfogetParameterInfoForMetaType (int type)
 returns a parameter info for the given metatype (and creates and caches one if it is not yet present) More...
 
static int getInnerTemplateMetaType (const QByteArray &typeName)
 returns the inner type id of a simple template of the form SomeObject<InnerType> More...
 
static QByteArray getInnerTemplateTypeName (const QByteArray &typeName)
 returns the inner type name of a simple template of the form SomeObject<InnerType> More...
 
static QByteArray getInnerListTypeName (const QByteArray &typeName)
 returns the inner type name of a simple template or the typename without appended "List". More...
 

Additional Inherited Members

- Protected Member Functions inherited from PythonQtMethodInfo
void setupAllowThreads ()
 
- Protected Attributes inherited from PythonQtMethodInfo
QList< ParameterInfo_parameters
 
bool _shouldAllowThreads
 
- Static Protected Attributes inherited from PythonQtMethodInfo
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 More...
 
static QHash< int, ParameterInfo_cachedParameterInfos
 

Detailed Description

stores information about a slot, including a next pointer to overloaded slots

Definition at line 152 of file PythonQtMethodInfo.h.

Member Enumeration Documentation

◆ Type

Enumerator
MemberSlot 
InstanceDecorator 
ClassDecorator 

Definition at line 155 of file PythonQtMethodInfo.h.

Constructor & Destructor Documentation

◆ PythonQtSlotInfo() [1/2]

PythonQtSlotInfo::PythonQtSlotInfo ( const PythonQtSlotInfo info)
inline

Definition at line 159 of file PythonQtMethodInfo.h.

159  :PythonQtMethodInfo() {
160  _meta = info._meta;
161  _parameters = info._parameters;
163  _slotIndex = info._slotIndex;
164  _next = nullptr;
165  _decorator = info._decorator;
166  _type = info._type;
167  _upcastingOffset = 0;
168  }
QList< ParameterInfo > _parameters

References PythonQtMethodInfo::_parameters, and PythonQtMethodInfo::_shouldAllowThreads.

◆ PythonQtSlotInfo() [2/2]

PythonQtSlotInfo::PythonQtSlotInfo ( PythonQtClassInfo classInfo,
const QMetaMethod &  meta,
int  slotIndex,
QObject *  decorator = nullptr,
Type  type = MemberSlot 
)
inline

Definition at line 170 of file PythonQtMethodInfo.h.

171  {
172  const PythonQtMethodInfo* info = getCachedMethodInfo(meta, classInfo);
173  _meta = meta;
174  _parameters = info->parameters();
176  _slotIndex = slotIndex;
177  _next = nullptr;
178  _decorator = decorator;
179  _type = type;
180  _upcastingOffset = 0;
181  }
stores information about a specific signal/slot/method
const QList< ParameterInfo > & parameters() const
get the parameter infos
static const PythonQtMethodInfo * getCachedMethodInfo(const QMetaMethod &method, PythonQtClassInfo *classInfo)
bool shouldAllowThreads() const
int slotIndex() const
get the index of the slot (needed for qt_metacall)
QObject * decorator() const

References PythonQtMethodInfo::parameters(), and PythonQtMethodInfo::shouldAllowThreads().

Member Function Documentation

◆ arguments()

QList<ParameterInfo> PythonQtSlotInfo::arguments ( ) const

get the parameter infos for the arguments, without return type and instance decorator.

◆ decorator()

QObject* PythonQtSlotInfo::decorator ( ) const
inline

Definition at line 211 of file PythonQtMethodInfo.h.

211 { return _decorator; }

◆ deleteOverloadsAndThis()

void PythonQtSlotInfo::deleteOverloadsAndThis ( )

◆ fullSignature()

QString PythonQtSlotInfo::fullSignature ( bool  skipReturnValue = false,
int  optionalArgsIndex = -1 
) const

get the full signature including return type

◆ getGlobalShouldAllowThreads()

static bool PythonQtSlotInfo::getGlobalShouldAllowThreads ( )
static

Returns if calling slots should release the GIL to allow Python threads while being inside of C++.

◆ getImplementingClassName()

QByteArray PythonQtSlotInfo::getImplementingClassName ( ) const

Returns the class name that originally implements this method, regardless where the wrapper is located/implemented.

◆ invokeQtMethod()

static void PythonQtSlotInfo::invokeQtMethod ( QObject *  obj,
PythonQtSlotInfo slot,
void **  argList 
)
static

Invoke the given slot on obj, save/restore thread state if needed.

◆ isClassDecorator()

bool PythonQtSlotInfo::isClassDecorator ( ) const
inline

returns if the slot is a constructor slot

Definition at line 209 of file PythonQtMethodInfo.h.

209 { return _decorator!=nullptr && _type == ClassDecorator; }

◆ isInstanceDecorator()

bool PythonQtSlotInfo::isInstanceDecorator ( ) const
inline

returns if the slot is a decorator slot

Definition at line 206 of file PythonQtMethodInfo.h.

206 { return _decorator!=nullptr && _type == InstanceDecorator; }

◆ metaMethod()

const QMetaMethod* PythonQtSlotInfo::metaMethod ( ) const
inline

Definition at line 190 of file PythonQtMethodInfo.h.

190 { return &_meta; }

◆ nextInfo()

PythonQtSlotInfo* PythonQtSlotInfo::nextInfo ( ) const
inline

get next overloaded slot (which has the same name)

Definition at line 200 of file PythonQtMethodInfo.h.

200 { return _next; }

◆ overloads()

QStringList PythonQtSlotInfo::overloads ( bool  skipReturnValue = false) const

gets a list of all overload signatures. Signatures which only differ because of default values are joined using "[]" to indicate the optional arguments.

◆ setGlobalShouldAllowThreads()

static void PythonQtSlotInfo::setGlobalShouldAllowThreads ( bool  flag)
static

Sets if calling slots should release the GIL to allow other Python threads while being inside of C++.

◆ setNextInfo()

void PythonQtSlotInfo::setNextInfo ( PythonQtSlotInfo next)
inline

set the next overloaded slot

Definition at line 203 of file PythonQtMethodInfo.h.

203 { _next = next; }

◆ setUpcastingOffset()

void PythonQtSlotInfo::setUpcastingOffset ( int  upcastingOffset)
inline

Definition at line 192 of file PythonQtMethodInfo.h.

192 { _upcastingOffset = upcastingOffset; }
int upcastingOffset() const

◆ signature()

QByteArray PythonQtSlotInfo::signature ( ) const

get the Qt signature of the slot

◆ slotIndex()

int PythonQtSlotInfo::slotIndex ( ) const
inline

get the index of the slot (needed for qt_metacall)

Definition at line 197 of file PythonQtMethodInfo.h.

197 { return _slotIndex; }

◆ slotName()

QByteArray PythonQtSlotInfo::slotName ( bool  removeDecorators = false) const

get the short slot name

◆ upcastingOffset()

int PythonQtSlotInfo::upcastingOffset ( ) const
inline

Definition at line 194 of file PythonQtMethodInfo.h.

194 { return _upcastingOffset; }

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