MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / fromQAction

Method fromQAction

src/Gui/PythonWrapper.cpp:753–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

751}
752
753Py::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
778Py::Object PythonWrapper::fromQPrinter(QPrinter* printer)
779{

Callers 2

getActionMethod · 0.80
getActionMethod · 0.80

Calls 3

addQObjectMethod · 0.80
instanceFunction · 0.70
isNullMethod · 0.45

Tested by

no test coverage detected