Gui: Use freecad_cast whenever possible
This commit is contained in:
committed by
Benjamin Nauck
parent
585d277e49
commit
ef357aa07a
@@ -1582,7 +1582,7 @@ void TreeWidget::selectAllLinks(App::DocumentObject* obj) {
|
||||
TREE_ERR("invalid linked object");
|
||||
continue;
|
||||
}
|
||||
auto vp = dynamic_cast<ViewProviderDocumentObject*>(
|
||||
auto vp = freecad_cast<ViewProviderDocumentObject*>(
|
||||
Application::Instance->getViewProvider(link));
|
||||
if (!vp) {
|
||||
TREE_ERR("invalid view provider of the linked object");
|
||||
@@ -2198,7 +2198,7 @@ bool TreeWidget::dropInDocument(QDropEvent* event, TargetItemInfo& targetInfo,
|
||||
auto doc = App::GetApplication().getDocument(info.doc.c_str());
|
||||
if (!doc) continue;
|
||||
auto obj = doc->getObject(info.obj.c_str());
|
||||
auto vpc = dynamic_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(obj));
|
||||
auto vpc = freecad_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(obj));
|
||||
if (!vpc) {
|
||||
FC_WARN("Cannot find dragging object " << info.obj);
|
||||
continue;
|
||||
@@ -2247,7 +2247,7 @@ bool TreeWidget::dropInDocument(QDropEvent* event, TargetItemInfo& targetInfo,
|
||||
continue;
|
||||
}
|
||||
auto parent = parentDoc->getObject(info.parent.c_str());
|
||||
auto vpp = dynamic_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(parent));
|
||||
auto vpp = freecad_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(parent));
|
||||
if (!vpp) {
|
||||
FC_WARN("Cannot find dragging object's parent " << info.parent);
|
||||
continue;
|
||||
@@ -2496,7 +2496,7 @@ bool TreeWidget::dropInObject(QDropEvent* event, TargetItemInfo& targetInfo,
|
||||
continue;
|
||||
}
|
||||
auto obj = doc->getObject(info.obj.c_str());
|
||||
auto vpc = dynamic_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(obj));
|
||||
auto vpc = freecad_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(obj));
|
||||
if (!vpc) {
|
||||
FC_WARN("Cannot find dragging object " << info.obj);
|
||||
continue;
|
||||
@@ -2507,7 +2507,7 @@ bool TreeWidget::dropInObject(QDropEvent* event, TargetItemInfo& targetInfo,
|
||||
auto parentDoc = App::GetApplication().getDocument(info.parentDoc.c_str());
|
||||
if (parentDoc) {
|
||||
auto parent = parentDoc->getObject(info.parent.c_str());
|
||||
vpp = dynamic_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(parent));
|
||||
vpp = freecad_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(parent));
|
||||
}
|
||||
if (!vpp) {
|
||||
FC_WARN("Cannot find dragging object's parent " << info.parent);
|
||||
@@ -2819,7 +2819,7 @@ void TreeWidget::sortDroppedObjects(TargetItemInfo& targetInfo, std::vector<App:
|
||||
|
||||
// Then we set the tree rank
|
||||
for (size_t i = 0; i < sortedObjList.size(); ++i) {
|
||||
auto vp = dynamic_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(sortedObjList[i]));
|
||||
auto vp = freecad_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(sortedObjList[i]));
|
||||
vp->setTreeRank(i);
|
||||
}
|
||||
|
||||
@@ -3871,7 +3871,7 @@ void DocumentItem::slotInEdit(const Gui::ViewProviderDocumentObject& v)
|
||||
std::string subname;
|
||||
auto vp = doc->getInEdit(&parentVp, &subname);
|
||||
if (!parentVp)
|
||||
parentVp = dynamic_cast<ViewProviderDocumentObject*>(vp);
|
||||
parentVp = freecad_cast<ViewProviderDocumentObject*>(vp);
|
||||
if (parentVp)
|
||||
getTree()->editingItem = findItemByObject(true, parentVp->getObject(), subname.c_str());
|
||||
}
|
||||
@@ -4260,7 +4260,7 @@ int DocumentItem::findRootIndex(App::DocumentObject* childObj) {
|
||||
return vp->getTreeRank();
|
||||
};
|
||||
|
||||
auto vpc = dynamic_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(childObj));
|
||||
auto vpc = freecad_cast<ViewProviderDocumentObject*>(Application::Instance->getViewProvider(childObj));
|
||||
int childTreeRank = getTreeRank(vpc);
|
||||
|
||||
// find the last item
|
||||
|
||||
Reference in New Issue
Block a user