PythonQt
Functions
PythonQtUtils Namespace Reference

Functions

QByteArray signature (const QMetaMethod &method)
 
QByteArray methodName (const QMetaMethod &method)
 
QByteArray typeName (const QMetaMethod &method)
 
bool isPythonClassType (PyObject *obj)
 Returns of the python object is a class type.
 
int metaTypeIdFromTypeName (const QByteArray &className)
 Returns the meta type ID from a type name.
 
const chartypeNameFromMetaTypeId (int metaTypeId)
 Returns the type name from a meta type ID.
 

Function Documentation

◆ isPythonClassType()

bool PythonQtUtils::isPythonClassType ( PyObject obj)
inline

Returns of the python object is a class type.

Definition at line 89 of file PythonQtUtils.h.

90{
91 return PyType_Check(obj);
92}
PyObject * PythonQtConvertPairToPython(const void *inPair, int metaTypeId)

References PythonQtConvertPairToPython().

◆ metaTypeIdFromTypeName()

int PythonQtUtils::metaTypeIdFromTypeName ( const QByteArray className)
inline

Returns the meta type ID from a type name.

Definition at line 95 of file PythonQtUtils.h.

96{
97#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
98 return QMetaType::fromName(className.constData()).id();
99#else
100 return QMetaType::type(className.constData());
101#endif
102}

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

◆ methodName()

QByteArray PythonQtUtils::methodName ( const QMetaMethod method)
inline

Definition at line 62 of file PythonQtUtils.h.

63{
64#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
65 return method.name();
66#else
67 QByteArray sig(method.signature());
68 int idx = sig.indexOf('(');
69 sig = sig.left(idx);
70 return sig;
71#endif
72}

References PythonQtConvertPairToPython().

◆ signature()

QByteArray PythonQtUtils::signature ( const QMetaMethod method)
inline

Definition at line 53 of file PythonQtUtils.h.

54{
55#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
56 return method.methodSignature();
57#else
58 return QByteArray(method.signature());
59#endif
60}

References PythonQtConvertPairToPython().

◆ typeName()

QByteArray PythonQtUtils::typeName ( const QMetaMethod method)
inline

Definition at line 74 of file PythonQtUtils.h.

75{
76#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
77 QByteArray result = method.typeName();
78 if (result == "void") {
79 return QByteArray();
80 } else {
81 return result;
82 }
83#else
84 return method.typeName();
85#endif
86}

References PythonQtConvertPairToPython().

◆ typeNameFromMetaTypeId()

const char * PythonQtUtils::typeNameFromMetaTypeId ( int  metaTypeId)
inline