| 242 | } |
| 243 | |
| 244 | Py::Object addQGIToView(const Py::Tuple& args) |
| 245 | { |
| 246 | PyObject *viewPy = nullptr; |
| 247 | PyObject *qgiPy = nullptr; |
| 248 | if (!PyArg_ParseTuple(args.ptr(), "O!O", &(TechDraw::DrawViewPy::Type), &viewPy, &qgiPy)) { |
| 249 | throw Py::TypeError("expected (view, item)"); |
| 250 | } |
| 251 | |
| 252 | try { |
| 253 | App::DocumentObject* obj = nullptr; |
| 254 | Gui::ViewProvider* vp = nullptr; |
| 255 | QGIView* qgiv = nullptr; |
| 256 | obj = static_cast<App::DocumentObjectPy*>(viewPy)->getDocumentObjectPtr(); |
| 257 | vp = Gui::Application::Instance->getViewProvider(obj); |
| 258 | if (vp) { |
| 259 | TechDrawGui::ViewProviderDrawingView* vpdv = |
| 260 | dynamic_cast<TechDrawGui::ViewProviderDrawingView*>(vp); |
| 261 | if (vpdv) { |
| 262 | qgiv = vpdv->getQView(); |
| 263 | if (qgiv) { |
| 264 | Gui::PythonWrapper wrap; |
| 265 | if (!wrap.loadGuiModule()) { |
| 266 | throw Py::RuntimeError("Failed to load Python wrapper for Qt::Gui"); |
| 267 | } |
| 268 | QGraphicsItem* item = wrap.toQGraphicsItem(args[1]); |
| 269 | if (item) { |
| 270 | qgiv->addArbitraryItem(item); |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | catch (Base::Exception &e) { |
| 277 | e.setPyException(); |
| 278 | throw Py::Exception(); |
| 279 | } |
| 280 | |
| 281 | return Py::None(); |
| 282 | } |
| 283 | |
| 284 | Py::Object addQGObjToView(const Py::Tuple& args) |
| 285 | { |
nothing calls this directly
no test coverage detected