| 678 | } |
| 679 | |
| 680 | Py::Object PythonWrapper::fromQImage(const QImage& img) |
| 681 | { |
| 682 | #if defined(HAVE_SHIBOKEN) && defined(HAVE_PYSIDE) |
| 683 | auto type = getPyTypeObjectForTypeName<QImage>(); |
| 684 | if (type) { |
| 685 | PyObject* pyobj = Shiboken::Conversions::copyToPython(type, const_cast<QImage*>(&img)); |
| 686 | return Py::asObject(pyobj); |
| 687 | } |
| 688 | #else |
| 689 | // Access shiboken/PySide via Python |
| 690 | Py::Object obj = qt_wrapInstance<const QImage*>(&img, "QImage", "QtGui"); |
| 691 | if (!obj.isNull()) { |
| 692 | return obj; |
| 693 | } |
| 694 | #endif |
| 695 | throw Py::RuntimeError("Failed to wrap image"); |
| 696 | } |
| 697 | |
| 698 | QImage* PythonWrapper::toQImage(PyObject* pyobj) |
| 699 | { |