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.
 

Function Documentation

◆ isPythonClassType()

bool PythonQtUtils::isPythonClassType ( PyObject obj)
inline

Returns of the python object is a class type.

Definition at line 86 of file PythonQtUtils.h.

86 {
87#ifdef PY3K
88 return PyType_Check(obj);
89#else
90 // support old-style classes and new style classes
91 return (obj->ob_type == &PyClass_Type || obj->ob_type == &PyType_Type);
92#endif
93 }
PyObject * PythonQtConvertPairToPython(const void *inPair, int metaTypeId)

References PythonQtConvertPairToPython().

◆ methodName()

QByteArray PythonQtUtils::methodName ( const QMetaMethod method)
inline

Definition at line 61 of file PythonQtUtils.h.

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

References PythonQtConvertPairToPython().

◆ signature()

QByteArray PythonQtUtils::signature ( const QMetaMethod method)
inline

Definition at line 53 of file PythonQtUtils.h.

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

References PythonQtConvertPairToPython().

◆ typeName()

QByteArray PythonQtUtils::typeName ( const QMetaMethod method)
inline

Definition at line 72 of file PythonQtUtils.h.

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

References PythonQtConvertPairToPython().