| 751 | } |
| 752 | |
| 753 | Py::Object PythonWrapper::fromQAction(QAction* action) |
| 754 | { |
| 755 | #if defined(HAVE_SHIBOKEN) && defined(HAVE_PYSIDE) |
| 756 | // Access shiboken/PySide via C++ |
| 757 | auto type = getPyTypeObjectForTypeName<QAction>(); |
| 758 | if (type) { |
| 759 | PyObject* pyobj = Shiboken::Object::newObject(type, action, false, false, "QAction"); |
| 760 | WrapperManager::instance().addQObject(action, pyobj); |
| 761 | return Py::asObject(pyobj); |
| 762 | } |
| 763 | #else |
| 764 | // Access shiboken/PySide via Python |
| 765 | # if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) |
| 766 | constexpr const char* qtModWithQAction = "QtWidgets"; |
| 767 | # else |
| 768 | constexpr const char* qtModWithQAction = "QtGui"; |
| 769 | # endif |
| 770 | Py::Object obj = qt_wrapInstance<QAction*>(action, "QAction", qtModWithQAction); |
| 771 | if (!obj.isNull()) { |
| 772 | return obj; |
| 773 | } |
| 774 | #endif |
| 775 | throw Py::RuntimeError("Failed to wrap action"); |
| 776 | } |
| 777 | |
| 778 | Py::Object PythonWrapper::fromQPrinter(QPrinter* printer) |
| 779 | { |
no test coverage detected