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

Method getActiveView

src/Gui/ViewProviderDocumentObject.cpp:450–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450Gui::MDIView* ViewProviderDocumentObject::getActiveView() const
451{
452 if (!pcObject) {
453 throw Base::RuntimeError("View provider detached");
454 }
455
456 if (!pcObject->isAttachedToDocument()) {
457 // Check if view provider is attached to a document as an annotation
458 for (auto doc : App::GetApplication().getDocuments()) {
459 auto guiDoc = Gui::Application::Instance->getDocument(doc);
460 if (guiDoc->isAnnotationViewProvider(this)) {
461 return guiDoc->getActiveView();
462 }
463 }
464 return nullptr;
465 }
466
467 App::Document* pAppDoc = pcObject->getDocument();
468 Gui::Document* pGuiDoc = Gui::Application::Instance->getDocument(pAppDoc);
469 return pGuiDoc->getActiveView();
470}
471
472Gui::MDIView* ViewProviderDocumentObject::getEditingView() const
473{

Callers

nothing calls this directly

Calls 4

getDocumentsMethod · 0.80
isAttachedToDocumentMethod · 0.45
getDocumentMethod · 0.45

Tested by

no test coverage detected