Core: modernize type checking

This commit is contained in:
Florian Foinant-Willig
2023-10-15 21:38:48 +02:00
parent 6d8fb68f3b
commit 773c701eec
31 changed files with 110 additions and 110 deletions

View File

@@ -222,7 +222,7 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args)
auto base =
static_cast<Base::BaseClass*>(Base::Type::createInstanceByName(vp.c_str(), true));
if (base
&& base->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
&& base->isDerivedFrom<Gui::ViewProviderDocumentObject>()) {
std::unique_ptr<Gui::ViewProviderDocumentObject> vp(
static_cast<Gui::ViewProviderDocumentObject*>(base));
std::map<std::string, App::Property*> Map;
@@ -231,7 +231,7 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args)
// this is needed to initialize Python-based view providers
App::Property* pyproxy = vp->getPropertyByName("Proxy");
if (pyproxy && pyproxy->getTypeId() == App::PropertyPythonObject::getClassTypeId()) {
if (pyproxy && pyproxy->is<App::PropertyPythonObject>()) {
static_cast<App::PropertyPythonObject*>(pyproxy)->setValue(Py::Long(1));
}
@@ -1702,7 +1702,7 @@ void Application::setupContextMenu(const char* recipient, MenuItem* items) const
if (actWb) {
// when populating the context-menu of a Python workbench invoke the method
// 'ContextMenu' of the handler object
if (actWb->getTypeId().isDerivedFrom(PythonWorkbench::getClassTypeId())) {
if (actWb->isDerivedFrom<PythonWorkbench>()) {
static_cast<PythonWorkbench*>(actWb)->clearContextMenu();
Base::PyGILStateLocker lock;
PyObject* pWorkbench = nullptr;