Gui: support of wrapping QImage
This commit is contained in:
@@ -583,9 +583,39 @@ QGraphicsObject* PythonWrapper::toQGraphicsObject(PyObject* pyPtr)
|
||||
|
||||
QGraphicsObject* PythonWrapper::toQGraphicsObject(const Py::Object& pyobject)
|
||||
{
|
||||
return toQGraphicsObject(pyobject.ptr());
|
||||
return toQGraphicsObject(pyobject.ptr());
|
||||
}
|
||||
|
||||
Py::Object PythonWrapper::fromQImage(const QImage& img)
|
||||
{
|
||||
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
|
||||
#if defined (HAVE_SHIBOKEN2)
|
||||
PyObject* pyobj = Shiboken::Conversions::copyToPython(reinterpret_cast<SbkObjectType*>(getPyTypeObjectForTypeName<QImage>()),
|
||||
const_cast<QImage*>(&img));
|
||||
#else
|
||||
PyObject* pyobj = Shiboken::Conversions::copyToPython(getPyTypeObjectForTypeName<QImage>(),
|
||||
const_cast<QImage*>(&img));
|
||||
#endif
|
||||
if (pyobj) {
|
||||
return Py::asObject(pyobj);
|
||||
}
|
||||
#else
|
||||
// Access shiboken/PySide via Python
|
||||
//
|
||||
return qt_wrapInstance<const QImage*>(&img, "QImage", shiboken, PySide + ".QtGui", "wrapInstance");
|
||||
#endif
|
||||
throw Py::RuntimeError("Failed to wrap icon");
|
||||
}
|
||||
|
||||
QImage *PythonWrapper::toQImage(PyObject *pyobj)
|
||||
{
|
||||
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
|
||||
return qt_getCppType<QImage>(pyobj);
|
||||
#else
|
||||
Q_UNUSED(pyobj);
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py::Object PythonWrapper::fromQIcon(const QIcon* icon)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user