Simplify logic using freecad_dynamic_cast

This commit is contained in:
Benjamin Nauck
2025-01-17 18:45:34 +01:00
parent 45c997f40a
commit cb4ee4737d
5 changed files with 56 additions and 63 deletions

View File

@@ -143,12 +143,8 @@ void DemoMode::hideEvent(QHideEvent*)
Gui::View3DInventor* DemoMode::activeView() const
{
Document* doc = Application::Instance->activeDocument();
if (doc) {
MDIView* view = doc->getActiveView();
if (view && view->isDerivedFrom(Gui::View3DInventor::getClassTypeId())) {
return static_cast<Gui::View3DInventor*>(view);
}
if (Document* doc = Application::Instance->activeDocument()) {
return Base::freecad_dynamic_cast<Gui::View3DInventor>(doc->getActiveView());
}
return nullptr;