PythonQt
|
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 More... | |
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, More... | |
static void * | ConvertPythonToQt (const PythonQtMethodInfo::ParameterInfo &info, PyObject *obj, bool strict, PythonQtClassInfo *classInfo, void *alreadyAllocatedCPPObject, PythonQtArgumentFrame *frame=nullptr) |
convert python object to Qt (according to the given parameter) and if the conversion should be strict (classInfo is currently not used anymore) More... | |
static void * | CreateQtReturnValue (const PythonQtMethodInfo::ParameterInfo &info, PythonQtArgumentFrame *frame) |
creates a data storage for the passed parameter type and returns a void pointer to be set as arg[0] of qt_metacall More... | |
static PyObject * | QStringToPyObject (const QString &str) |
converts QString to Python string (unicode!) More... | |
static PyObject * | QStringListToPyObject (const QStringList &list) |
converts QStringList to Python tuple More... | |
static PyObject * | QStringListToPyList (const QStringList &list) |
converts QStringList to Python list More... | |
static QString | PyObjGetRepresentation (PyObject *val) |
get string representation of py object More... | |
static QString | PyObjGetString (PyObject *val) |
get string value from py object More... | |
static QString | PyObjGetString (PyObject *val, bool strict, bool &ok) |
get string value from py object More... | |
static QByteArray | PyObjGetBytes (PyObject *val, bool strict, bool &ok) |
get bytes from py object More... | |
static QByteArray | PyObjGetBytesAllowString (PyObject *val, bool strict, bool &ok) |
get bytes from py object, also allows Python string More... | |
static int | PyObjGetInt (PyObject *val, bool strict, bool &ok) |
get int from py object More... | |
static qint64 | PyObjGetLongLong (PyObject *val, bool strict, bool &ok) |
get int64 from py object More... | |
static quint64 | PyObjGetULongLong (PyObject *val, bool strict, bool &ok) |
get int64 from py object More... | |
static double | PyObjGetDouble (PyObject *val, bool strict, bool &ok) |
get double from py object More... | |
static bool | PyObjGetBool (PyObject *val, bool strict, bool &ok) |
get bool from py object More... | |
static QStringList | PyObjToStringList (PyObject *val, bool strict, bool &ok) |
create a string list from python sequence More... | |
static QVariant | PyObjToQVariant (PyObject *val, int type=-1) |
static PyObject * | QVariantToPyObject (const QVariant &v) |
convert QVariant from PyObject More... | |
static PyObject * | QVariantHashToPyObject (const QVariantHash &m) |
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) More... | |
static void | registerPythonToMetaTypeConverter (int metaTypeId, PythonQtConvertPythonToMetaTypeCB *cb) |
register a converter callback from python to cpp for given metatype More... | |
static void | registerMetaTypeToPythonConverter (int metaTypeId, PythonQtConvertMetaTypeToPythonCB *cb) |
register a converter callback from cpp to python for given metatype More... | |
static void | setPythonSequenceToQVariantListCallback (PythonQtConvertPythonSequenceToQVariantListCB *cb) |
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, More... | |
static PyObject * | createCopyFromMetaType (int type, const void *object) |
creates a copy of given object, using the QMetaType More... | |
static void * | castWrapperTo (PythonQtInstanceWrapper *wrapper, const QByteArray &className, bool &ok) |
cast wrapper to given className if possible More... | |
static bool | convertToPythonQtObjectPtr (PyObject *obj, void *outPtr, int, bool) |
static PyObject * | convertFromPythonQtObjectPtr (const void *inObject, int) |
static bool | convertToPythonQtSafeObjectPtr (PyObject *obj, void *outPtr, int, bool) |
static PyObject * | convertFromPythonQtSafeObjectPtr (const void *inObject, int) |
static bool | convertToQListOfPythonQtObjectPtr (PyObject *obj, void *outList, int, bool) |
static PyObject * | convertFromQListOfPythonQtObjectPtr (const void *inObject, int) |
static PyObject * | convertFromStringRef (const void *inObject, int) |
static QByteArray | getCPPTypeName (PyObject *type) |
Returns the name of the equivalent CPP type (for signals and slots) More... | |
static bool | isStringType (PyTypeObject *type) |
Returns if the given object is a string (or unicode string) More... | |
static void | registerStringViewTypes () |
Register QStringView like types, that need to be handled specially. More... | |
Static Protected Member Functions | |
static void * | handlePythonToQtAutoConversion (int typeId, PyObject *obj, void *alreadyAllocatedCPPObject, PythonQtArgumentFrame *frame) |
handle automatic conversion of some special types (QColor, QBrush, ...) More... | |
static PyObject * | ConvertQListOfPointerTypeToPythonList (QList< void * > *list, const PythonQtMethodInfo::ParameterInfo &info) |
converts the list of pointers of given type to Python More... | |
static bool | ConvertPythonListToQListOfPointerType (PyObject *obj, QList< void * > *list, const PythonQtMethodInfo::ParameterInfo &info, bool strict) |
tries to convert the python object to a QList of pointers to type objects, returns true on success More... | |
template<typename Map > | |
static void | pythonToMapVariant (PyObject *val, QVariant &result) |
helper template method for conversion from Python to QVariantMap/Hash More... | |
template<typename Map > | |
static PyObject * | mapToPython (const Map &m) |
helper template function for QVariantMapToPyObject/QVariantHashToPyObject More... | |
Static Protected Attributes | |
static QHash< int, PythonQtConvertMetaTypeToPythonCB * > | _metaTypeToPythonConverters |
static QHash< int, PythonQtConvertPythonToMetaTypeCB * > | _pythonToMetaTypeConverters |
static PythonQtConvertPythonSequenceToQVariantListCB * | _pythonSequenceToQVariantListCB |
static int | stringRefTypeId |
a static class that offers methods for type conversion
Definition at line 101 of file PythonQtConversion.h.
|
static |
cast wrapper to given className if possible
Referenced by PythonQtConvertPythonListToListOfKnownClass().
|
static |
|
static |
|
static |
|
static |
|
staticprotected |
tries to convert the python object to a QList of pointers to type
objects, returns true on success
|
static |
convert python object to Qt (according to the given parameter) and if the conversion should be strict (classInfo is currently not used anymore)
|
staticprotected |
converts the list of pointers of given type to Python
|
static |
converts the Qt parameter given in data
, interpreting it as a info
parameter, into a Python object,
|
static |
converts the Qt parameter given in data
, interpreting it as a type
registered qvariant/meta type, into a Python object,
Referenced by PythonQtConvertIntegerMapToPython(), PythonQtConvertListOfValueTypeToPythonList(), and PythonQtConvertPairToPython().
|
static |
|
static |
|
static |
|
static |
get human readable string from CPP object (when the metatype is known)
|
static |
creates a copy of given object, using the QMetaType
|
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 |
Returns the name of the equivalent CPP type (for signals and slots)
|
static |
get a ref counted True or False Python object
|
staticprotected |
handle automatic conversion of some special types (QColor, QBrush, ...)
|
static |
Returns if the given object is a string (or unicode string)
|
staticprotected |
helper template function for QVariantMapToPyObject/QVariantHashToPyObject
|
static |
get bool from py object
|
static |
get bytes from py object
|
static |
get bytes from py object, also allows Python string
|
static |
get double from py object
|
static |
get int from py object
Referenced by PythonQtConvertPythonToIntegerMap().
|
static |
get int64 from py object
|
static |
get string representation of py object
|
inlinestatic |
get string value from py object
Definition at line 130 of file PythonQtConversion.h.
References PyObjGetString().
Referenced by PyObjGetString().
|
static |
get string value from py object
|
static |
get int64 from py object
|
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(), PythonQtConvertPythonToIntegerMap(), and PythonQtConvertPythonToPair().
|
static |
create a string list from python sequence
|
staticprotected |
helper template method for conversion from Python to QVariantMap/Hash
|
static |
converts QStringList to Python list
|
static |
converts QStringList to Python tuple
|
static |
converts QString to Python string (unicode!)
|
static |
|
static |
|
static |
|
static |
convert QVariant from PyObject
|
inlinestatic |
register a converter callback from cpp to python for given metatype
Definition at line 169 of file PythonQtConversion.h.
|
inlinestatic |
register a converter callback from python to cpp for given metatype
Definition at line 166 of file PythonQtConversion.h.
|
static |
Register QStringView like types, that need to be handled specially.
|
inlinestatic |
set a callback that is called when a Python sequence should be converted to a QVariantList to allow special conversion.
Definition at line 173 of file PythonQtConversion.h.
|
staticprotected |
Definition at line 208 of file PythonQtConversion.h.
|
staticprotected |
Definition at line 210 of file PythonQtConversion.h.
|
staticprotected |
Definition at line 209 of file PythonQtConversion.h.
|
staticprotected |
Definition at line 228 of file PythonQtConversion.h.