Use is<T>() when possible

This commit is contained in:
Benjamin Nauck
2025-01-15 22:31:36 +01:00
parent 5e72f6e5e1
commit ae15d98fd3
10 changed files with 46 additions and 39 deletions

View File

@@ -160,10 +160,7 @@ bool ViewProviderAssembly::doubleClicked()
bool ViewProviderAssembly::canDragObject(App::DocumentObject* obj) const
{
// The user should not be able to drag the joint group out of the assembly
if (!obj || obj->getTypeId() == Assembly::JointGroup::getClassTypeId()) {
return false;
}
return true;
return obj && !obj->is<Assembly::JointGroup>();
}
bool ViewProviderAssembly::canDragObjectToTarget(App::DocumentObject* obj,
@@ -1028,9 +1025,8 @@ bool ViewProviderAssembly::onDelete(const std::vector<std::string>& subNames)
{
// Delete the assembly groups when assembly is deleted
for (auto obj : getObject()->getOutList()) {
if (obj->getTypeId() == Assembly::JointGroup::getClassTypeId()
|| obj->getTypeId() == Assembly::ViewGroup::getClassTypeId()
|| obj->getTypeId() == Assembly::BomGroup::getClassTypeId()) {
if (obj->is<Assembly::JointGroup>() || obj->is<Assembly::ViewGroup>()
|| obj->is<Assembly::BomGroup>()) {
// Delete the group content first.
Gui::Command::doCommand(Gui::Command::Doc,