diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp index 7b9c563725..7e930e6215 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp @@ -92,7 +92,7 @@ DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent ) ui->themesCombobox->setEnabled(true); Gui::Document* doc = Gui::Application::Instance->activeDocument(); if (doc) { - Gui::View3DInventor* view = static_cast(doc->getActiveView()); + Gui::View3DInventor* view = qobject_cast(doc->getActiveView()); if (view) { Gui::View3DInventorViewer* viewer = view->getViewer(); if (viewer->isEditing()) { @@ -640,7 +640,7 @@ void DlgSettingsGeneral::recreatePreferencePackMenu() button->setEnabled(true); Gui::Document* doc = Gui::Application::Instance->activeDocument(); if (doc) { - Gui::View3DInventor* view = static_cast(doc->getActiveView()); + Gui::View3DInventor* view = qobject_cast(doc->getActiveView()); if (view) { Gui::View3DInventorViewer* viewer = view->getViewer(); if (viewer->isEditing()) { diff --git a/src/Gui/TextureMapping.cpp b/src/Gui/TextureMapping.cpp index 72a5e565dd..ecede365c4 100644 --- a/src/Gui/TextureMapping.cpp +++ b/src/Gui/TextureMapping.cpp @@ -142,14 +142,13 @@ void TextureMapping::onFileChooserFileNameSelected(const QString& s) if (!this->grp) { Gui::Document* doc = Gui::Application::Instance->activeDocument(); if (doc) { - Gui::MDIView* mdi = doc->getActiveView(); - if (mdi && mdi->isDerivedFrom()) { - Gui::View3DInventorViewer* view = static_cast(mdi)->getViewer(); - this->grp = static_cast(view->getSceneGraph()); + auto view = qobject_cast(doc->getActiveView()); + if (view) { + this->grp = static_cast(view->getViewer()->getSceneGraph()); this->grp->ref(); - this->grp->insertChild(this->tex,1); + this->grp->insertChild(this->tex, 1); if (ui->checkEnv->isChecked()) - this->grp->insertChild(this->env,2); + this->grp->insertChild(this->env, 2); } } } diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index 1f04a65a10..45fca8baf4 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -227,12 +227,10 @@ void ViewProvider::eventCallback(void * ud, SoEventCallback * node) // react only on key release // Let first selection mode terminate Gui::Document* doc = Gui::Application::Instance->activeDocument(); - auto view = static_cast(doc->getActiveView()); - if (view) - { + const auto view = qobject_cast(doc->getActiveView()); + if (view) { Gui::View3DInventorViewer* viewer = view->getViewer(); - if (viewer->isSelecting()) - { + if (viewer->isSelecting()) { return; } }