a static class that offers methods for type conversion More...
#include <PythonQtConversion.h>
Static Public Member Functions | |
| static PyObject * | GetPyBool (bool val) |
| get a ref counted True or False Python object | |
| static PyObject * | ConvertQtValueToPython (const PythonQtMethodInfo::ParameterInfo &info, const void *data) |
converts the Qt parameter given in data, interpreting it as a info parameter, into a Python object, | |
| static void * | ConvertPythonToQt (const PythonQtMethodInfo::ParameterInfo &info, PyObject *obj, bool strict, PythonQtClassInfo *classInfo, void *alreadyAllocatedCPPObject=NULL) |
| convert python object to Qt (according to the given parameter) and if the conversion should be strict (classInfo is currently not used anymore) | |
| static void * | CreateQtReturnValue (const PythonQtMethodInfo::ParameterInfo &info) |
| creates a data storage for the passed parameter type and returns a void pointer to be set as arg[0] of qt_metacall | |
| static PyObject * | QStringToPyObject (const QString &str) |
| converts QString to Python string (unicode!) | |
| static PyObject * | QStringListToPyObject (const QStringList &list) |
| converts QStringList to Python tuple | |
| static PyObject * | QStringListToPyList (const QStringList &list) |
| converts QStringList to Python list | |
| static QString | PyObjGetRepresentation (PyObject *val) |
| get string representation of py object | |
| static QString | PyObjGetString (PyObject *val) |
| get string value from py object | |
| static QString | PyObjGetString (PyObject *val, bool strict, bool &ok) |
| get string value from py object | |
| static QByteArray | PyObjGetBytes (PyObject *val, bool strict, bool &ok) |
| get bytes from py object | |
| static int | PyObjGetInt (PyObject *val, bool strict, bool &ok) |
| get int from py object | |
| static qint64 | PyObjGetLongLong (PyObject *val, bool strict, bool &ok) |
| get int64 from py object | |
| static quint64 | PyObjGetULongLong (PyObject *val, bool strict, bool &ok) |
| get int64 from py object | |
| static double | PyObjGetDouble (PyObject *val, bool strict, bool &ok) |
| get double from py object | |
| static bool | PyObjGetBool (PyObject *val, bool strict, bool &ok) |
| get bool from py object | |
| static QStringList | PyObjToStringList (PyObject *val, bool strict, bool &ok) |
| create a string list from python sequence | |
| static QVariant | PyObjToQVariant (PyObject *val, int type=-1) |
| static PyObject * | QVariantToPyObject (const QVariant &v) |
| convert QVariant from PyObject | |
| static PyObject * | QVariantMapToPyObject (const QVariantMap &m) |
| static PyObject * | QVariantListToPyObject (const QVariantList &l) |
| static QString | CPPObjectToString (int type, const void *data) |
| get human readable string from CPP object (when the metatype is known) | |
| static void | registerPythonToMetaTypeConverter (int metaTypeId, PythonQtConvertPythonToMetaTypeCB *cb) |
| register a converter callback from python to cpp for given metatype | |
| static void | registerMetaTypeToPythonConverter (int metaTypeId, PythonQtConvertMetaTypeToPythonCB *cb) |
| register a converter callback from cpp to python for given metatype | |
| static int | getInnerTemplateMetaType (const QByteArray &typeName) |
| returns the inner type id of a simple template of the form SomeObject<InnerType> | |
| static PyObject * | ConvertQtValueToPythonInternal (int type, const void *data) |
converts the Qt parameter given in data, interpreting it as a type registered qvariant/meta type, into a Python object, | |
Static Public Attributes | |
| static PythonQtValueStorage < qint64, 128 > | global_valueStorage |
| static PythonQtValueStorage < void *, 128 > | global_ptrStorage |
| static PythonQtValueStorage < QVariant, 32 > | global_variantStorage |
Static Protected Member Functions | |
| static void * | handlePythonToQtAutoConversion (int typeId, PyObject *obj, void *alreadyAllocatedCPPObject) |
| handle automatic conversion of some special types (QColor, QBrush, ...) | |
| static PyObject * | ConvertQListOfPointerTypeToPythonList (QList< void * > *list, const QByteArray &type) |
| converts the list of pointers of given type to Python | |
| static bool | ConvertPythonListToQListOfPointerType (PyObject *obj, QList< void * > *list, const QByteArray &type, bool strict) |
tries to convert the python object to a QList of pointers to type objects, returns true on success | |
| static void * | castWrapperTo (PythonQtInstanceWrapper *wrapper, const QByteArray &className, bool &ok) |
| cast wrapper to given className if possible | |
Static Protected Attributes | |
| static QHash< int, PythonQtConvertMetaTypeToPythonCB * > | _metaTypeToPythonConverters |
| static QHash< int, PythonQtConvertPythonToMetaTypeCB * > | _pythonToMetaTypeConverters |
a static class that offers methods for type conversion
Definition at line 70 of file PythonQtConversion.h.
| static void* PythonQtConv::castWrapperTo | ( | PythonQtInstanceWrapper * | wrapper, | |
| const QByteArray & | className, | |||
| bool & | ok | |||
| ) | [static, protected] |
cast wrapper to given className if possible
| static bool PythonQtConv::ConvertPythonListToQListOfPointerType | ( | PyObject * | obj, | |
| QList< void * > * | list, | |||
| const QByteArray & | type, | |||
| bool | strict | |||
| ) | [static, protected] |
tries to convert the python object to a QList of pointers to type objects, returns true on success
| static void* PythonQtConv::ConvertPythonToQt | ( | const PythonQtMethodInfo::ParameterInfo & | info, | |
| PyObject * | obj, | |||
| bool | strict, | |||
| PythonQtClassInfo * | classInfo, | |||
| void * | alreadyAllocatedCPPObject = NULL | |||
| ) | [static] |
convert python object to Qt (according to the given parameter) and if the conversion should be strict (classInfo is currently not used anymore)
| static PyObject* PythonQtConv::ConvertQListOfPointerTypeToPythonList | ( | QList< void * > * | list, | |
| const QByteArray & | type | |||
| ) | [static, protected] |
converts the list of pointers of given type to Python
| static PyObject* PythonQtConv::ConvertQtValueToPython | ( | const PythonQtMethodInfo::ParameterInfo & | info, | |
| const void * | data | |||
| ) | [static] |
converts the Qt parameter given in data, interpreting it as a info parameter, into a Python object,
| static PyObject* PythonQtConv::ConvertQtValueToPythonInternal | ( | int | type, | |
| const void * | data | |||
| ) | [static] |
converts the Qt parameter given in data, interpreting it as a type registered qvariant/meta type, into a Python object,
Referenced by PythonQtConvertListOfValueTypeToPythonList().
| static QString PythonQtConv::CPPObjectToString | ( | int | type, | |
| const void * | data | |||
| ) | [static] |
get human readable string from CPP object (when the metatype is known)
| static void* PythonQtConv::CreateQtReturnValue | ( | const PythonQtMethodInfo::ParameterInfo & | info | ) | [static] |
creates a data storage for the passed parameter type and returns a void pointer to be set as arg[0] of qt_metacall
| static int PythonQtConv::getInnerTemplateMetaType | ( | const QByteArray & | typeName | ) | [static] |
returns the inner type id of a simple template of the form SomeObject<InnerType>
Referenced by PythonQtConvertListOfValueTypeToPythonList(), and PythonQtConvertPythonListToListOfValueType().
| static PyObject* PythonQtConv::GetPyBool | ( | bool | val | ) | [static] |
get a ref counted True or False Python object
| static void* PythonQtConv::handlePythonToQtAutoConversion | ( | int | typeId, | |
| PyObject * | obj, | |||
| void * | alreadyAllocatedCPPObject | |||
| ) | [static, protected] |
handle automatic conversion of some special types (QColor, QBrush, ...)
| static bool PythonQtConv::PyObjGetBool | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
get bool from py object
| static QByteArray PythonQtConv::PyObjGetBytes | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
get bytes from py object
| static double PythonQtConv::PyObjGetDouble | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
get double from py object
| static int PythonQtConv::PyObjGetInt | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
get int from py object
| static qint64 PythonQtConv::PyObjGetLongLong | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
get int64 from py object
| static QString PythonQtConv::PyObjGetRepresentation | ( | PyObject * | val | ) | [static] |
get string representation of py object
| static QString PythonQtConv::PyObjGetString | ( | PyObject * | val | ) | [inline, static] |
get string value from py object
Definition at line 99 of file PythonQtConversion.h.
References PyObjGetString().
Referenced by PyObjGetString().
{ bool ok; QString s = PyObjGetString(val, false, ok); return s; }
| static QString PythonQtConv::PyObjGetString | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
get string value from py object
| static quint64 PythonQtConv::PyObjGetULongLong | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
get int64 from py object
| static QVariant PythonQtConv::PyObjToQVariant | ( | PyObject * | val, | |
| int | type = -1 | |||
| ) | [static] |
convert python object to qvariant, if type is given it will try to create a qvariant of that type, otherwise it will guess from the python type
Referenced by PythonQtConvertPythonListToListOfValueType().
| static QStringList PythonQtConv::PyObjToStringList | ( | PyObject * | val, | |
| bool | strict, | |||
| bool & | ok | |||
| ) | [static] |
create a string list from python sequence
| static PyObject* PythonQtConv::QStringListToPyList | ( | const QStringList & | list | ) | [static] |
converts QStringList to Python list
| static PyObject* PythonQtConv::QStringListToPyObject | ( | const QStringList & | list | ) | [static] |
converts QStringList to Python tuple
| static PyObject* PythonQtConv::QStringToPyObject | ( | const QString & | str | ) | [static] |
converts QString to Python string (unicode!)
| static PyObject* PythonQtConv::QVariantListToPyObject | ( | const QVariantList & | l | ) | [static] |
| static PyObject* PythonQtConv::QVariantMapToPyObject | ( | const QVariantMap & | m | ) | [static] |
| static PyObject* PythonQtConv::QVariantToPyObject | ( | const QVariant & | v | ) | [static] |
convert QVariant from PyObject
| static void PythonQtConv::registerMetaTypeToPythonConverter | ( | int | metaTypeId, | |
| PythonQtConvertMetaTypeToPythonCB * | cb | |||
| ) | [inline, static] |
register a converter callback from cpp to python for given metatype
Definition at line 135 of file PythonQtConversion.h.
{ _metaTypeToPythonConverters.insert(metaTypeId, cb); }
| static void PythonQtConv::registerPythonToMetaTypeConverter | ( | int | metaTypeId, | |
| PythonQtConvertPythonToMetaTypeCB * | cb | |||
| ) | [inline, static] |
register a converter callback from python to cpp for given metatype
Definition at line 132 of file PythonQtConversion.h.
{ _pythonToMetaTypeConverters.insert(metaTypeId, cb); }
QHash<int, PythonQtConvertMetaTypeToPythonCB*> PythonQtConv::_metaTypeToPythonConverters [static, protected] |
Definition at line 150 of file PythonQtConversion.h.
QHash<int, PythonQtConvertPythonToMetaTypeCB*> PythonQtConv::_pythonToMetaTypeConverters [static, protected] |
Definition at line 151 of file PythonQtConversion.h.
PythonQtValueStorage<void*, 128> PythonQtConv::global_ptrStorage [static] |
Definition at line 146 of file PythonQtConversion.h.
PythonQtValueStorage<qint64, 128> PythonQtConv::global_valueStorage [static] |
Definition at line 145 of file PythonQtConversion.h.
PythonQtValueStorage<QVariant, 32> PythonQtConv::global_variantStorage [static] |
Definition at line 147 of file PythonQtConversion.h.
1.7.1