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 87 of file PythonQtUtils.h.

87 {
88#ifdef PY3K
89 return PyType_Check(obj);
90#else
91 // support old-style classes and new style classes
92 return (obj->ob_type == &PyClass_Type || obj->ob_type == &PyType_Type);
93#endif
94 }
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 97 of file PythonQtUtils.h.

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

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

◆ methodName()

QByteArray PythonQtUtils::methodName ( const QMetaMethod method)
inline

Definition at line 62 of file PythonQtUtils.h.

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

References PythonQtConvertPairToPython().

◆ signature()

QByteArray PythonQtUtils::signature ( const QMetaMethod method)
inline

Definition at line 54 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 73 of file PythonQtUtils.h.

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

References PythonQtConvertPairToPython().

◆ typeNameFromMetaTypeId()

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